| 主題回顧 |
| Robert |
發表於 - 09/26/2004 : 8:44:45 PM 資料來源:http://destiny.xfiles.to/ubbthreads/showflat.php?Cat=0&Number=680600&page=9&view=collapsed&sb=5&o=14&fpart=1#680600
突發奇想~~
試以 Object Oriented Programming 的概念看[共盤]。
命盤是 abstract class, 命主是 implementation 。
假設命盤有 30 萬個﹐則有 30 萬個 abstract class 。
假設某星球有 30 億人﹐則平均每個命盤有 1 萬個 implementation 。
既然 1 萬個 implementation 源自同一個 abstract class﹐ 當然他們是有共同點的。
雖然如此﹐他們也有不同點﹐因為 implementation 可以選擇性的 implement abstract methods, 又或簡直不 implement 某些 method , 不同的 implementation 更可以用不同的方法 (父母不同﹐大環境不同) 來 implement 同一個 method 以及加入自己的 private protected methods 。
一個 class 被設計好了﹐要 compile (孕育) 成功 (出世) 才有用。如 compiler (母體) 有問題﹐又或 version (年份) 不一樣﹐則會影響 final implementation 的素質﹐有 bug 就當然有缺陷了。
試做軟體 (人體) 設計~~
interface Planet { } interface Continent { } interface Country { } interface Environment { } interface Mother { } interface Father { } abstract class LifeChartPattern_001 { } abstract class LifeChartPattern_002 { } abstract class LifeChartPattern_003 { } ... ... abstract class LifeChartPattern_098 { } abstract class LifeChartPattern_099 { } abstract class LifeChartPattern_100 { }
public class Lincoln (命主) extends LifeChartPattern_001 (abstract class) implements Mother, Father (父母) { public Lincoln() (大環境設定) { setPlanet("Earth"); setContinent("North America"); setCountry("United States of America"); setEnvironment("Democratic, Capitalism, 2004"); } }
哈哈~~ 有趣有趣~~
|
| 最近回文 1篇 (由新而舊) |
| Robert |
發表於 - 09/26/2004 : 8:45:11 PM 雙胞胎~~
abstract class Twins extends LifeChartPattern_088 implements Mother, Father { public Twins() { setPlanet("Earth"); setContinent("North America"); setCountry("United States of America"); setEnvironment("Democratic, Capitalism, 2004"); } }
public class Lincoln extends Twins { } public class Clinton extends Twins { }
|
|
|