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

3,749 questions

4,049 answers


10,705 users

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

0 votes
asked 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 by sunny Expert (11,410 points)

Related questions

0 votes
1 answer 14 views
0 votes
1 answer 22 views
0 votes
1 answer 15 views
15 views asked by rock Expert (14,990 points)
0 votes
1 answer 31 views
0 votes
0 answers 116 views