Multiple inheritance in Java/C#

Sean Ross sross at connectmail.carleton.ca
Wed Nov 19 10:24:27 EST 2003


"Hung Jung Lu" <hungjunglu at yahoo.com> wrote in message
news:8ef9bea6.0311182031.38034c10 at posting.google.com...
> Does anyone know how to emulate Python-like MI in Java/C#?

Hi.
I believe this is usually done using a design pattern - I think its called
"the proxy object pattern" or it may be "the delegator pattern", I'm not
sure. I know that for doing CORBA programming with Java, you can have tie
classes (which I believe use the aforementioned design pattern) generated to
help simulate multiple inheritance. The idea is something like this: you
have class C which inherits from A but you would like to have a class that
inherits from A and B; make a class D that inherits from B, and that keeps
an instance of C; D is your class that "inherits" from A and B; when you
have an instance of d and you call a method derived from A, you delegate to
the instance of C, otherwise you handle it directly. I think that's the
general idea. You should be able to find specific examples somewhere online.

HTH
Sean






More information about the Python-list mailing list