.NET Solving the Multiple Inheritance Issue Under .NET Platform

April 14th, 2008

.NET papers does not hold binary inheritance. Do not tack multilevel acquisition with binary inheritance. With binary acquisition we crapper hit a subclass that inherits from digit classes at the aforementioned time.

Let’s presume we hit an covering that has a collection Customers and added collection Vendors. If you desired to consortium these digit classes into digit CustomerVendor collection it would be a compounding of Customers and Vendors meet aforementioned the draw below.

Please double the mass address into your covering to analyse the diagram: http://www.vbprofs.com/images/Article Images/ThomasArt1.gif

In the above draw we wager how the CustomerVendor collection inherits from both of those classes.

Multiple acquisition is Byzantine and crapper be dangerous. The advantages of cipher re-usage exist over complexness is up to your choice.

Multiple acquisition is not based by VB.NET or .Net platform. Instead of binary acquisition we crapper ingest binary interfaces to attain kindred gist to binary inheritance.

In VB.NET every objects hit a direct or autochthonous interface, which is imperturbable of properties, events, methods or member variables proclaimed using Public keyword.
Objects crapper compel also alternative interfaces by using Implement keyword.

Sometimes it is adjuvant for an goal to hit more than digit interface, allowing us to interact with the goal in assorted ways. Inheritance earmark us to create subclasses that are a special housing of the humble class.

Example

Sometimes we hit a assemble of objects that are not the similar, but we poverty to appendage them the aforementioned manner. We poverty every the objects to behave as if they are the same, modify though they are different.

We crapper hit whatever assorted objects in an application, much as customer, product, invoice etc. Each goal would hit a choice programme pertinent to apiece individualist object, and apiece of them is a assorted class. No uncolored acquisition is tacit between these classes.
Let’s presume we poverty to indicant a writing for apiece identify of object. In this housing we’d aforementioned to attain them every behave as printable object.
To fulfill this we crapper delimitate a generic programme that would enable generating a printed document.
By implementing a ordinary programme we are healthy to indite a turn that accepts some goal that implements a printed document.

To conclude, by implementing binary interfaces in VB.NET , we crapper attain a kindred gist to that of binary inheritance.

Thomas is an old Visual Basic developer, with skillfulness of 7+ eld nonindustrial especially business applications. His important IT skills are VB, SQL, Crystal Reports - should you requirement a Visual Basic developer for your projects see liberated to occurrence saint finished his individualized website Kaloyani.com or finished VBprofs.com - the newest Visual Basic and VB.NET resources portal.

Tags: , , , , , , , , , , , , , , , , , , , ,

Leave a Reply

Close
E-mail It