Berkeley CSUA MOTD:Entry 35808
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/27 [General] UID:1000 Activity:popular
5/27    

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.