.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.

In The News:


pen paper and inkwell


cat break through


Microsoft Great Plains: Large Scale Implementation

Microsoft Business Solutions Great Plains, Navision, Axapta, Solomon and CRM... Read More

Perfectly New Database Query Tool - Foxy SQL Pro Released

Are you a database professional? Do you work with a... Read More

Microsoft CRM ? Typical Customizations

Microsoft CRM was designed to be easily customizable. Microsoft CRM... Read More

Selecting Corporate ERP: Microsoft Business Solutions Great Plains ? Estimation Parameters

As we could imagine, if you are reading this article... Read More

Create ASP in Minutes

DBxtra goes ASPGetting to the information hidden within corporate databases... Read More

Microsoft CRM USA Nationwide Remote Support

Remember old good days when your company probably had Great... Read More

How To Identify, Cure and Prevent Spyware/Adware Infections

Just when you thought you were Web savvy, one more... Read More

Industry Experts Answer the One Million-dollar Question - Why Genie Backup Manager?

Many reasons made GBM a unanimous choice for experts, one... Read More

Document Templates Give You The Perfect Framework For Your Documents

When it comes to running an office, the SOHO entrepreneur... Read More

Groupware and Version History: Collaboration Series #1

This article is the first of a series of articles... Read More

Reporting Tools for Microsoft Great Plains ? Overview For Developers

Looks like Microsoft Great Plains becomes more and more popular,... Read More

Microsoft Great Plains Upgrade ? Version 8.0 Overview for IT Director/Controller

If you have Microsoft Great Plains as main accounting and... Read More

Will Adobe Manage to Replace Industry Work Horse Quark Express by Giving Adobe InDesign for Free?

And kill the best layout software in the process of... Read More

The True Meaning of Freeware

The vast majority of us will have, at some point,... Read More

How to Choose the Right Accounting Software for Your Business

With any good luck and a good amount of hard... Read More

S is for Spying, Surveillance -- and for Software as Well

Words we choose to describe things and phenomena often show... Read More

Off The Record - Tips For Picking Recording Software

Need software to record your voice, streaming audio or musical... Read More

Is Software Tester a Most Infamous Person in a Software Project Team?

The fact that a software tester is a most infamous... Read More

Story Development Software: Good or Evil?

In the early days of the personal computer, we're talking... Read More

Computer Based Language Development and Spell-checking

Language development computer: Computer-based method for aiding language development seems... Read More

Guide to Software Marketing

Intro This concise article will tell you in plain English... Read More

Keeping Track

One of the things we can be as certain of... Read More

The XP Firewall Isnt Enough

You might think you don't need a firewall... Read More

Microsoft Business Solutions Products Selection: ERP, CRM, Retail Management

Let's first look at your ERP system selection (without Retail... Read More

Save Your Resources - Combine Your IM Clients

There are so many different programs that clutter up your... Read More

Beware of The Pirated Software E-Mail Scams!

You have gotten those E_Mails buy software at deep discounts.... Read More

Microsoft Great Plains Implementation in Russia ? Overview for Consultant

Microsoft Business Solutions Great Plains is very popular ERP platform... Read More

Introducing GRML

Creating a new markup language.Introduction.General Reuse Markup Langauge, or GRML,... Read More

HelpDesk & Asset Management Software - Choosing The Right One

If you are to buy a HelpDesk & Asset Management... Read More

Microsoft Great Plains customization ? Freight Forwarding/Transportation industry example

Microsoft Business Solutions Great Plains version 8.5, 8.0, 7.5, Great... Read More

Microsoft Great Plains Jewelry ? Implementation & Customization Overview

Each Industry and market niche has business specific and unique... Read More

Screenplay and Script Writing Software

When it comes to screenplay software each screenwriter needs to... Read More

Linux ? Keyboard Or Mouse

Just stress testing one of the latest Linux distributions. Been... Read More