C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers

114 comments

10,705 users

Can you explain what inheritance is and an example of when you might use it?

0 votes
41 views
asked Apr 3, 2014 by sunny Expert (11,410 points)

1 Answer

0 votes
Inheritance allows us to extend the functionality of a base class. It is an "Is a" type of relationship rather than a "Uses" type of relationship (a dalmation IS A dog which IS A canine which IS A mammal - dalmations inherist from dog which inherits from canine which inherits from mammal). All child classes retain the properties and methods of their parent classes but may override them. When you want to inherit (use the functionality of) another class. Base Class
Employee. A Manager class could be derived from the Employee base class.
answered Apr 3, 2014 by sunny Expert (11,410 points)

Related questions

0 votes
1 answer 14 views
14 views asked Jan 9, 2014 by john Guru (27,140 points)
0 votes
1 answer 21 views
0 votes
1 answer 14 views
14 views asked May 12, 2014 by rock Expert (14,990 points)
0 votes
1 answer 30 views
30 views asked Oct 15, 2011 by anonymous
0 votes
0 answers 112 views
...