Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Disadvantages of Inheritance

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 10-02-2010
Member
 
Join Date: Dec 2009
Posts: 67
Disadvantages of Inheritance
  

Hello friend,

I need your help to solve my confusion regarding the inheritance. The inheritance concept of object oriented programming basically used for make reusability of the program code. But I want to be aware about the disadvantages of using inheritance. If you knows any disadvantages of 'Inheritance', then please let me know that. I would appreciate your help.

Reply With Quote
  #2  
Old 10-02-2010
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: Disadvantages of Inheritance

Hi friend,

According to me the disadvantage of using inheritance is that, it brings vulnerability in program. Multiple inheritance may create serious problems in following situation:
  • The members management of the same name inherited from parent classes
  • The management of the repetition inheritance.
Reply With Quote
  #3  
Old 10-02-2010
Member
 
Join Date: May 2008
Posts: 2,007
Re: Disadvantages of Inheritance

Multiple inheritance can pose difficult problems, so there is controversy over whether its benefits outweigh its disadvantages. Java has the following compromise: it allows a class to inherit interfaces more than one parent (that is to say that we can specify that a class should have all the methods exposed outside its parent interface, and allow the compiler 's sure), but it can inherit methods and data from a single parent class. Languages such as Microsoft C # and Visual Basic implement this same approach.
Reply With Quote
  #4  
Old 10-02-2010
Member
 
Join Date: Apr 2008
Posts: 2,000
Re: Disadvantages of Inheritance

The main problem with inheritance comes from entities as a method or member that is present several times in the ancestors of a class. For example if you define a class App for portable devices powered by a battery, a class Such for mobile phones that inherits AppA class Ordn for laptops that inherits App and finally a class TelOrdn used for mobile computers that also inherits Ordn and Such. So it is not clear whether the bodies TelOrdn contain one or two batteries and under what name to differentiate them.
Reply With Quote
  #5  
Old 10-02-2010
Member
 
Join Date: May 2008
Posts: 2,291
Re: Disadvantages of Inheritance

The inheritance turns into disadvantage when it comes to compile or run programs using classes in multiple inheritance. Indeed in the case of polymorphic method call (when one method has several versions in classes inheriting from each other), we must find which method should be executed. As part of a single inheritance, the ancestors of a class make a list and it is easy to create a table of dynamic binding allows a simple test to find the correct version. As part of a multiple inheritance the ancestors of a class now form a graph and the table of dynamic binding is more difficult to create.
Reply With Quote
  #6  
Old 10-02-2010
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: Disadvantages of Inheritance

OOP provides the virtual inheritance as a complementary tool less ambitious. The refinement of the semantic mechanisms brought into play in multiple inheritance has discouraged many users and explains the bad reputation he has gained in part from the developer community. Nevertheless algorithms exist for this compilation, it is possible to resolve multiple inheritance with the same cost to run the simple inheritance. Obviously it is impossible to use these techniques with languages that are not compiled, in which case it must traverse the inheritance graph at runtime, which can be quite long.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Disadvantages of Inheritance"
Thread Thread Starter Forum Replies Last Post
What is the difference between Single inheritance and multilevel inheritance? Venugopala Software Development 3 08-01-2011 06:32 AM
What are the disadvantages of XML? ScarFace 01 Software Development 4 11-02-2010 02:40 PM
What is an Inheritance in C#? - Empty Shell - Software Development 4 09-02-2010 07:03 AM
Does anyone know disadvantages of C++? Sarfaraj Khan Software Development 4 06-02-2010 02:43 PM
Genericity and Inheritance Ricky58 Software Development 4 31-10-2009 12:41 AM


All times are GMT +5.5. The time now is 04:43 AM.