TITLE: Private inheritance versus delegation (forwarding) PROBLEM: manim@apertus.com (Mani Malarvannan) I have two questions: 1. What is the advantage of private inheritance over delegation.? 2. When to use private inheritance and when to use delegation.? RESPONSE: rmartin@rcmcon.com (Robert Martin), 23 Aug 94 There are several advantages that PI has over delegation. 1. You save the pointer to the delegate. 2. You save the dereference time to the delegate. 3. You can override virtual functions of the private base. 4. You can convert the derived class into a pointer to the private base which can be passed to object who know how to use the private base. Through virtual functions, such users will actually be communicating with the derived class. There are several advantages to using delegation over PI. 1. It is generally simpler to understand. 2. You can have more than one delegate. 3. You can replace the delegate dynamically.