Class Refinement

For a group of related classes, you can refactor the common code into a base class. The base class can then be inherited into one or more specific (derived) classes where the code is reused. Derived classes also are called descendants or child classes. Inheritance implies code reuse. The child classes then can extend (refine) the base class. A personnel application might have SalariedEmployee, HourlyEmployee, and CommissionedEmployee classes that inherit from the Employee class. The Employee class contains the common members of the Employee related classes. Each derived class adds methods or fields to extend and refine the base class. Inheritance and polymorphism are closely related. Polymorphism calls the correct method at run ...

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.