From c6cd5a0dc016be7e261813b532d0425cac0f34a4 Mon Sep 17 00:00:00 2001 From: MasatoIso <04masato05@gmail.com> Date: Fri, 19 Nov 2021 21:41:23 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=89=E5=86=85=E3=81=AE?= =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92=E7=BF=BB=E8=A8=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- future-javascript/classes/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/future-javascript/classes/README.md b/future-javascript/classes/README.md index 909393b5..81b350c3 100644 --- a/future-javascript/classes/README.md +++ b/future-javascript/classes/README.md @@ -137,9 +137,9 @@ abstract class FooCommand {} class BarCommand extends FooCommand {} -const fooCommand: FooCommand = new FooCommand(); // Cannot create an instance of an abstract class. +const fooCommand: FooCommand = new FooCommand(); // 抽象クラスのインスタンスは作成できません -const barCommand = new BarCommand(); // You can create an instance of a class that inherits from an abstract class. +const barCommand = new BarCommand(); // 抽象クラスを継承したクラスのインスタンスは作成できます ``` * 抽象メンバは直接アクセスできません。子クラスがその具体的な機能(実装)を提供しなくてはなりません @@ -149,17 +149,17 @@ abstract class FooCommand { abstract execute(): string; } -class BarErrorCommand extends FooCommand {} // 'BarErrorCommand' needs implement abstract member 'execute'. +class BarErrorCommand extends FooCommand {} // 'BarErrorCommand'は抽象メンバー'execute'を実装する必要があります class BarCommand extends FooCommand { execute() { - return `Command Bar executed`; + return `コマンドBarが実行されました`; } } const barCommand = new BarCommand(); -barCommand.execute(); // Command Bar executed +barCommand.execute(); // コマンドBarが実行されました ``` ## コンストラクタは必須ではありません @@ -199,7 +199,7 @@ class Foo { ```typescript class Foo { - members = []; // Initialize directly + members = []; // コンストラクタなしで直接メンバ変数を初期化できます add(x) { this.members.push(x); }