Last active
August 29, 2015 14:01
-
-
Save kawakawa/ff20a98ef41101c04c13 to your computer and use it in GitHub Desktop.
ギルドワークス株式会社 増田 亨さんからのオブジェクト指向設計の問題
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
public abstract class 顧客区分{ | |
private String 区分名; | |
private int デフォルト料金; | |
protected 料金 my料金object; | |
public 顧客区分(料金 料金object){ | |
my料金object=料金object; | |
} | |
private void set区分名(String 名前){ | |
this.区分名=名前; | |
} | |
private void setデフォルト料金(int デフォルト料金){ | |
this.デフォルト料金=デフォルト料金; | |
} | |
public String Get区分名(){ | |
return this.区分名; | |
} | |
public int Get料金(){ | |
return my料金.Get料金(this.デフォルト料金); | |
} | |
} | |
public class 料金{ | |
public int Get料金(int デフォルト料金){ | |
return デフォルト料金; | |
} | |
} | |
public class おとな extends 顧客区分{ | |
public おとな(料金 料金object){ | |
super(料金object); | |
this.set区分名("おとな"); | |
this.setデフォルト料金(100); | |
} | |
} | |
public class こども extends 顧客区分{ | |
public こども(料金 料金object){ | |
super(料金object); | |
this.set区分名("こども"); | |
this.setデフォルト料金(50); | |
} | |
} | |
public class シルバー extends 顧客区分{ | |
public シルバー(料金 料金object){ | |
super(料金object); | |
this.set区分名("シルバー"); | |
this.setデフォルト料金(20); | |
} | |
} |
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
ギルドワークス株式会社 増田 亨さんからのオブジェクト指向設計の問題 | |
https://codeiq.jp/ace/guildworks_masuda_toru/q875 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment