Chapter 3. Inheritance
Inheritance is a "is a kind of" relationship and the cornerstone of object-oriented programming. For example, a rectangle, an ellipse, and a triangle are "a kind of" shape. Without inheritance, you would have to fully and independently implement the rectangle, ellipse, and triangle classes. It is better to extrapolate the common elements of any shape and place those elements into a general class. That general class then can be inherited into the specific shape classes. This avoids having to implement the same code in every shape class. Code reuse is one of the primary benefits of inheritance. The general class is called a base class. The specific classes, such as rectangle, ellipse, and triangle, are considered derived classes. ...
Get Programming Microsoft® Visual C#® 2008: The Language now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.