¥DÃD¦^ÅU |
Robert |
µoªí©ó - 09/26/2004 : 8:44:45 PM ¸ê®Æ¨Ó·½¡Ghttp://destiny.xfiles.to/ubbthreads/showflat.php?Cat=0&Number=680600&page=9&view=collapsed&sb=5&o=14&fpart=1#680600
¬ðµo©_·Q~~
¸Õ¥H Object Oriented Programming ªº·§©À¬Ý[¦@½L]¡C
©R½L¬O abstract class, ©R¥D¬O implementation ¡C
°²³]©R½L¦³ 30 ¸UÓ¡M«h¦³ 30 ¸UÓ abstract class ¡C
°²³]¬Y¬P²y¦³ 30 »õ¤H¡M«h¥§¡¨CÓ©R½L¦³ 1 ¸UÓ implementation ¡C
¬JµM 1 ¸UÓ implementation ·½¦Û¦P¤@Ó abstract class¡M ·íµM¥L̬O¦³¦@¦PÂIªº¡C
ÁöµM¦p¦¹¡M¥L̤]¦³¤£¦PÂI¡M¦]¬° implementation ¥i¥H¿ï¾Ü©Êªº implement abstract methods, ¤S©Î²ª½¤£ implement ¬Y¨Ç method , ¤£¦Pªº implementation §ó¥i¥H¥Î¤£¦Pªº¤èªk (¤÷¥À¤£¦P¡M¤jÀô¹Ò¤£¦P) ¨Ó implement ¦P¤@Ó method ¥H¤Î¥[¤J¦Û¤vªº private protected methods ¡C
¤@Ó class ³Q³]p¦n¤F¡Mn compile (¥¥¨|) ¦¨¥\ (¥X¥@) ¤~¦³¥Î¡C¦p compiler (¥ÀÅé) ¦³°ÝÃD¡M¤S©Î version (¦~¥÷) ¤£¤@¼Ë¡M«h·|¼vÅT final implementation ªº¯À½è¡M¦³ bug ´N·íµM¦³¯Ê³´¤F¡C
¸Õ°µ³nÅé (¤HÅé) ³]p~~
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 (©R¥D) extends LifeChartPattern_001 (abstract class) implements Mother, Father (¤÷¥À) { public Lincoln() (¤jÀô¹Ò³]©w) { setPlanet("Earth"); setContinent("North America"); setCountry("United States of America"); setEnvironment("Democratic, Capitalism, 2004"); } }
«¢«¢~~ ¦³½ì¦³½ì~~
|
³Ìªñ¦^¤å 1½g (¥Ñ·s¦ÓÂÂ) |
Robert |
µoªí©ó - 09/26/2004 : 8:45:11 PM ÂùML~~
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 { }
|
|
|