Multiple inheritance in Java/C#

Hung Jung Lu hungjunglu at yahoo.com
Thu Nov 20 07:52:10 EST 2003


"Sean Ross" <sross at connectmail.carleton.ca> wrote in message news:<4WLub.10649$ZF1.1133338 at news20.bellglobal.com>...
> 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.

Thanks. I am finding it to be the standard approach. In short:

  (containment+delegation) ---> aggregation.

Kind of laborious. But that's the way of life without true MI.

Hung Jung




More information about the Python-list mailing list