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

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-2024 ASPAlliance.com  |  Page Processed at 2024-04-24 11:00:00 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search