-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
12 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
"use strict"; | ||
// 復習問題10-1 抽象クラスの作成,10-2 | ||
class Zukei { | ||
const x = 5; | ||
const y = 0; | ||
if (y === 0) { | ||
//yが0のときは例外をスローしてプログラムを終了 | ||
throw new Error("ゼロで割り算はできません"); | ||
} | ||
class Eclipse extends Zukei { | ||
Draw() { | ||
console.log("楕円を描画します"); | ||
} | ||
} | ||
const ep = new Eclipse; | ||
ep.Draw; | ||
const ans = x / y; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,9 @@ | ||
// 復習問題10-1 抽象クラスの作成,10-2 | ||
abstract class Zukei{ | ||
abstract Draw():void; | ||
} | ||
const x:number=5; | ||
const y:number=0; | ||
|
||
class Eclipse extends Zukei{ | ||
Draw(): void { | ||
console.log("楕円を描画します"); | ||
} | ||
if(y===0){ | ||
//yが0のときは例外をスローしてプログラムを終了 | ||
throw new Error("ゼロで割り算はできません"); | ||
} | ||
|
||
const ep= new Eclipse; | ||
ep.Draw; | ||
|
||
//インターフェイスの作成 | ||
interface Telephone{ | ||
call():void; | ||
} | ||
const ans=x/y; |