| ||||||
| 5/16 |
| 2005/1/20 [Computer/SW/Languages/Java] UID:35808 Activity:nil |
1/20 I need to demonstrate a special case of polymophism. Say I have
a "class A" and a "class B" B inherits from A. A defines foo
and bar. B redefines bar. A.foo() calls this.bar(), so if we
call b.foo() we expect foo() to call the correct bar (B's).
Can anyone think of a simple real world case where this happens?
It's for a short talk I need to give, and I need a good example. |