foolish
2006-11-02 21:48:35 UTC
好不好很難講,
一切只看原po覺得適不適合 :d
[1;32m※ Origin: [33mSayYA 資訊站 [37m<bbs.sayya.org> [m
[1;31m◆ From: [36m163.26.34.248[m
一切只看原po覺得適不適合 :d
動態多形不好嗎?
class Base{
public void todo(){}
}
class DerivedA extends Base{
public void todo(){}
}
class DerivedB extends Base{
public void todo(){}
}
// ...
Vector<Base> v;
// ...
v.elementAt(0).todo();
v.elementAt(3).todo();
--class Base{
public void todo(){}
}
class DerivedA extends Base{
public void todo(){}
}
class DerivedB extends Base{
public void todo(){}
}
// ...
Vector<Base> v;
// ...
v.elementAt(0).todo();
v.elementAt(3).todo();
[1;32m※ Origin: [33mSayYA 資訊站 [37m<bbs.sayya.org> [m
[1;31m◆ From: [36m163.26.34.248[m