GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C++
Go To First  |  Previous Question  |  Next Question 
 C++  |  Question 116 of 203    Print  
What is proper and improper inheritance? Explain with an example?

  
Total Answers and Comments: 3 Last Update: July 31, 2009     Asked by: tanish 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
September 15, 2007 18:52:10   #1  
Raj        

RE: What is proper and improper inheritance? Explain ...
Improper inheritance is when multiple base class is used and derive a class then the class inheritance would be confusing. If the derived class cannot / possibly go to the base class then we say improper inheritance

Proper inheritance: The derived class should be in a clear position to reach the base class.

 
Is this answer useful? Yes | No
December 28, 2007 21:54:20   #2  
michaelpyles Member Since: December 2007   Contribution: 3    

RE: What is proper and improper inheritance? Explain with an example?
Proper inheritance occurs when the derived class "IS A" specialized type of the base class. Example Cat IS A Animal.
Improper inheritance occurs when a class is inherited from merely for code reuse without having any other relationship. Example Cat Inherits from Engine. A Cat is not an engine however both an engine and a cat purr.

 
Is this answer useful? Yes | No
July 30, 2009 23:13:39   #3  
yzesong Member Since: July 2009   Contribution: 20    

RE: What is proper and improper inheritance? Explain with an example?
As long as no diamond problems (improper inheritance) single or multiple inheritance can all be proper inheritance. When usng multiple inheritance with diamond problem you can use virtual inheritance to make the multiple inheritance a proper one.
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape