5.2. InheritanceIn C#, the specialization relationship is typically implemented using inheritance. This is not the only way to implement specialization, but it is the most common and most natural way to implement this relationship. Saying that ListBox inherits from (or derives from) Control indicates that it specializes Control. Control is referred to as the base class, and ListBox is referred to as the derived class. That is, ListBox derives its characteristics and behaviors from Control and then specializes to its own particular needs. 5.2.1. Implementing InheritanceIn C#, you create a derived class by adding a colon after the name of the derived class, followed by the name of the base class: public class ListBox : Control This code declares a new class, ListBox, that derives from Control. You can read the colon as "derives from."
The derived class inherits all the members of the base class, both member variables and methods. |