Simulating Multiple Inheritance by Delegation
page 2 of 5
by Joseph Chahine
Feedback
Average Rating: 
Views (Total / Last 10 Days): 27871/ 79

What is delegation?

As defined in the famous book "Design Patterns - Elements of Reusable Object-Oriented Software," Delegation is "a way of making composition as powerful for reuse as inheritance. In delegation, two objects are involved in handling a request: a receiving object delegates operations to its delegate. This is analogous to subclasses deferring requests to parent classes. But with inheritance, an inherited operation can always refer to the receiving object through the member variable in C++ and self in Smalltalk. To achieve the same effect with delegation, the receiver passes itself to the delegate to let the delegated operation refer to the receiver."

In short, delegation can be viewed as a relationship between objects where one object forwards (or delegate) certain method calls to another object.


View Entire Article

User Comments

No comments posted yet.






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-11-26 9:55:52 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search