Simulating Multiple Inheritance by Delegation
page 3 of 5
by Joseph Chahine
Feedback
Average Rating: 
Views (Total / Last 10 Days): 6769/ 112

When would you need it?

A simple example would be to consider that we are building a distributed application and we have a class called MyCustomCollection that inherits from System.Collections.ArrayList. We want to have instances of the MyCustomCollection class marshalled from a server to another across a firewall. In .NET, we have to derive MyCustomCollection from the MarshalByRefObject class, but is not MyCustomCollection a subclass of System.Collections.ArrayList already?! Unfortunately, we will not be able to derive MyCustomCollection from MarshalByRefObject because it can only inherit from one class, which is System.Collections.ArrayList.

In such cases, Multiple Inheritance could be helpful. Please note that there is no situation where multiple inheritance is necessary. Everything done with C++ can still be done with VB.NET or C#.NET. In this article I am just offering a workaround.


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 
Learn More
.NET Tools
asp.net shopping cart
asp.net chart control






Ads Powered by Lake Quincy Media
Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2008 ASPAlliance.com  |  Page Processed at 9/7/2008 4:26:46 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search