Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
compare webbrowser
Freenet DSL
Who's Online
7 user(s) are online (7 user(s) are browsing encyclopedia)

Members: 0
Guests: 7

more...
browser tip
Unix Befehle
manual of unix befehle
recommendation!
Sponsored
partner

Multiple inheritance

Some programming languages allow multiple inheritance, in which a class (computer science) can inherit behaviors and features from more than one superclass. This contrasts with single inheritance, where a class inherits from only one superclass (computer science).

Multiple inheritance can cause some confusing situations, so there is some debate over whether or not its benefits outweigh its risks. implement this interface approach as well.

In object oriented programming (OOP), inheritance (object-oriented programming) describes a relationship between two types, or classes, of objects in which one is said to be a subtype or child of the other. The child inherits features of the parent, allowing for shared functionality. For example, one might create a variable class Mammal with features such as eating, reproducing, etc.; then define a subtype Rat that inherits those features without having to explicitly program them, while adding new features like collecting garbage.

If, however, one wants to use more than one totally orthogonal hierarchy simultaneously, such as allowing Rat to inherit from Cartoon character and Disease vector as well as Mammal , lack of multiple inheritance often results in a very awkwardly mixed hierarchy, or forces functionality to be rewritten in more than one place (with the attendant maintenance problems).

Multiple inheritance has been a touchy issue for many years, with opponents pointing to its increased complexity and ambiguity. For example, if two parents have independent implementations of a feature named X, which one is inherited (This situation is commonly referred to as the diamond problem.)

Languages have different ways of dealing with these problems. Eiffel programming language, for example, allows subtypes to adapt their inherited features by renaming them or setting selection rules for them ahead of time. Java allows objects to inherit multiple interfaces but only a single implementation. REALbasic programming language is similar, but also allows additional methods to extend a class without inheritance. Perl programming language uses the list of classes to inherit from as an ordered list, and uses the first method it finds by depth-first searching first the current class, then the inherited classes in the order listed and their superclasses. CLOS allows for complete programmer control of method combination, and if that s not enough the meta-object protocol gives the programmer a means to modify the inheritance, method dispatch, class instantiation, and other internal mechanisms without affecting the stability of the system.

= External links =

*Article by Jonathan Lurie of Builder.Com on instances in .NET languages: http://builder.com.com/5100-6373-5030734.html