Results 1 to 6 of 6

Thread: Disadvantages of Inheritance

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

  2. #2
    Join Date
    Apr 2008
    Posts
    1,949

    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.

  3. #3
    Join Date
    May 2008
    Posts
    2,015

    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.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,010

    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.

  5. #5
    Join Date
    May 2008
    Posts
    2,302

    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.

  6. #6
    Join Date
    Oct 2005
    Posts
    2,394

    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.

Similar Threads

  1. Replies: 3
    Last Post: 08-01-2011, 05:32 AM
  2. What are the disadvantages of XML?
    By ScarFace 01 in forum Software Development
    Replies: 4
    Last Post: 11-02-2010, 01:40 PM
  3. What is an Inheritance in C#?
    By - Empty Shell - in forum Software Development
    Replies: 4
    Last Post: 09-02-2010, 06:03 AM
  4. Does anyone know disadvantages of C++?
    By Sarfaraj Khan in forum Software Development
    Replies: 4
    Last Post: 06-02-2010, 01:43 PM
  5. Genericity and Inheritance
    By Ricky58 in forum Software Development
    Replies: 4
    Last Post: 30-10-2009, 11:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •