interviews.dotnetthread.com

↑ Grab this Headline Animator

Saturday, May 3, 2008

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

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.

Submit this story to DotNetKicks

No comments:

Post a Comment

Post your comments/questions/feedback for this Article.

 

Latest Articles