18 March 2006 08:15
OOP Concept explained: Polymorphism (Technology) || kuro5hin.org
by felixlaumon & 5 othersPolymorphism 的講解,不過運用的是一個超淫的例子。衰得在他說得合題…
Quote:
//in Mouth
public void TakeALoad(Load l) {
//50-50 chance of spitting or swallowing
if(Math.RandomNumber() % 1 == 0) {
this.Spit(l);
} else {
this.Swallow(l);
}
}
Polymorphism (多態)
http://www.wgqqh.com/shhgs/book/chap7.pdf
1
(1 marks)