Delegation Inheritance

You can delegate operations of the pseudoderived class to an object of the pseudobase class member of the pseudoderived class, thus pseudoinheriting its implementation in the member object. Pseudoinheritance by delegation allows, with a little work, dynamic or multiple or otherwise fancy and customized pseudoinheritance in languages where actual inheritance is inadequate. LorenzoGatti

Some languages force you to use delegation inheritance (see PrototypeBasedProgramming). You say to see PrototypeBasedProgramming, but there's no conversation there about DelegationInheritance, how these languages force you to use it, or what if any facilities they provide to assist in doing DelegationInheritance easily. Could someone add some content on that?

There are two groups of object-based languages that don't use inheritance. Some don't support it and don't support any similarly expressive replacement, like VB6. However, prototype-based languages support dynamic delegation, in which the parent object(s) can be changed at run-time. This is more expressive than inheritance; it's not accurate to describe it as forcing workarounds.

VbClassic, the better VisualBasic, has a strange form of interface-only inheritance where you must cast an object reference to the appropriate interface in order to access its methods. Because implementation cannot be inherited, you must also resort to DelegationInheritance to simulate implementation inheritance. With two annoying roadblocks to ObjectOrientedProgramming, it's needless to say that few people have bothered to master OO in VB. [These comments are made of VB6; I haven't used any later versions.] See also InheritanceInVbClassic.


This is a subtle point, but perhaps we should be distinguishing between DelegationAndConsultation.


CategoryPolymorphism


EditText of this page (last edited January 31, 2009) or FindPage with title or text search