Software Information

.NET :Solving the Multiple Inheritance Issue Under .NET Platform


.NET platform does not support multiple inheritance. Do not confuse multilevel inheritance with multiple inheritance. With multiple inheritance we can have a subclass that inherits from two classes at the same time.

Let's suppose we have an application that has a class Customers and another class Vendors. If you wanted to combine these two classes into one CustomerVendor class it would be a combination of Customers and Vendors just like the diagram below.

Please copy the following URL into your browser to view the diagram: http://www.vbprofs.com/images/Article Images/ThomasArt1.gif

In the above diagram we see how the CustomerVendor class inherits from both of those classes.

Multiple inheritance is complex and can be dangerous. The advantages of code re-usage prevail over complexity is up to your choice.

Multiple inheritance is not supported by VB.NET or .Net platform. Instead of multiple inheritance we can use multiple interfaces to achieve similar effect to multiple inheritance.

In VB.NET all objects have a primary or native interface, which is composed of properties, events, methods or member variables declared using Public keyword. Objects can implement also secondary interfaces by using Implement keyword.

Sometimes it is helpful for an object to have more than one interface, allowing us to interact with the object in different ways. Inheritance allow us to create subclasses that are a specialized case of the base class.

Example

Sometimes we have a group of objects that are not the similar, but we want to handle them the same manner. We want all the objects to act as if they are the same, even though they are different.

We can have some different objects in an application, such as customer, product, invoice etc. Each object would have a default interface appropriate to each individual object, and each of them is a different class. No natural inheritance is implied between these classes. Let's suppose we want to print a document for each type of object. In this case we'd like to make them all act as printable object. To accomplish this we can define a generic interface that would enable generating a printed document. By implementing a common interface we are able to write a routine that accepts any object that implements a printed document.

To conclude, by implementing multiple interfaces in VB.NET , we can achieve a similar effect to that of multiple inheritance.

Thomas is an experienced Visual Basic developer, with expertise of 7+ years developing especially financial applications. His main IT skills are VB, SQL, Crystal Reports - should you need a Visual Basic developer for your projects feel free to contact Thomas through his personal website Kaloyani.com or through VBprofs.com - the newest Visual Basic and VB.NET resources portal.


MORE RESOURCES:

Earthtimes (press release)

Elliott Terminates Tender Offer to Acquire Epicor Software Corporation
MarketWatch - Nov 21, 2008
... LP and Elliott International, LP (collectively, "Elliott" or "we"), a major shareholder of Epicor Software Corporation (the "Company" or "Epicor"), ...
Epicor drops after hedge fund ends hostile bid Forbes
Hedge Fund Elliott Associates Withdraws Offer for Epicor Software Orange County Business Journal
UPDATE 1-Hedge Fund ends offer for Epicor Reuters
RTT News - Barron's Blogs
all 45 news articles


New York Times

The best thing about the 2.2 iPhone software update
CNET News, CA - 21 hours ago
When it some to iPhone software updates, I'm all about the basics. Apple could enable the iPhone to cook my dinner every night, but if it added multimedia ...
First Look: Apple's iPhone 2.2 Software Hits The Street (And ... CRN
Lots to like about new iPhone 2.2 software update Ars Technica
Apple releases iPhone Software v2.2 Apple Insider
G4 TV - infoSync World
all 142 news articles


Canada.com

Microsoft to offer free security software to attract beginners
eTaiwan News, Taiwan - Nov 21, 2008
19 to stop selling personal computer security software and to use free personal anti-virus software instead. The new software called Morro can support seven ...
Microsoft: New software not Symantec, McAfee rival Reuters
Spamhaus: Microsoft Now 5th Most Spam Friendly ISP Washington Post
Microsoft Plans to Introduce Free PC Security Software Wall Street Journal
NetworkWorld.com - AHN
all 304 news articles


Vertical Releases Feature-Rich Software Update for Wave
MarketWatch - 16 hours ago
... today announced the release of the Wave 1.5 software upgrade to it's award winning Wave IP 2500(TM) Business Communications Solution, the industry's ...


Hann’s On Software bouht by Mediware
Bizjournals.com, NC - 23 hours ago
Mediware Information Systems Inc. has bought the assets of Hann’s On Software, a pharmacy-management software provider based in Santa Rosa, for $3.5 million ...
Mediware Acquisition Adds 320 Pharmacy Facilities MarketWatch
Mediware Information buys assets of Hann's On Software - Quick Facts RTT News
Mediware Acquisition Adds 320 Pharmacy Facilities International Business Times
all 19 news articles


AVG Sees Uphill Battle for Microsoft in Its Launch of Free Anti ...
MarketWatch - Nov 21, 2008
AVG, which for eight years has offered free anti-virus software to users worldwide, noted the multiple challenges Microsoft faces in supporting a free ...
AVG sees 'uphill battle' for Microsoft Morro TechRadar UK
Microsoft Announces Upcoming Events for the Financial Community NewsBlaze
Microsoft Announces Upcoming Events for the Financial Community MarketWatch
all 30 news articles


Microsoft’s Mike Neil Keynotes at SYS-CON's 4th International ...
SYS-CON Media, NJ - 15 hours ago
... Black Duck Software, Blackbaud, Blade Network Technologies, Blue Coat, Blue Lane, BlueArc, BlueNote Networks, BluePheonix Solutions, BMC Software, ...
Teaching Everyone to Speak Big Blue New York Times
IBM To Acquire Virtualization Specialist Transitive InformationWeek
IBM To Buy Virtualization-Software Company Transitive NewsFactor Network
eWeek - SearchDataCenter.com
all 95 news articles


Frankly speaking, speech software better but still not great
Seattle Times, United States - 8 hours ago
Getting a computer to turn your speech into words on the screen requires buying expensive, resource-intensive software and mastering a sometimes confusing ...


Authoria Appoints New President and CEO
MarketWatch - 21 hours ago
Prior to joining Authoria, Mr. McDevitt was most recently Chief Operating Officer of CDC Software, a $360 million division of CDC Corporation and a global ...


Microsoft purges phony security software from 1 million PCs
Computerworld, MA - 18 hours ago
Windows users have been plagued with a flood of worthless security software in recent months as criminals have discovered that they're money-makers. ...

Software - Google News

home | site map
© 2006