In C#, the specialization relationship is implemented using a principle called inheritance . This is not the only way to implement specialization, but it is the most common and most natural way to implement this relationship.
from (or derives from)
indicates that it specializes
Window is referred to as the
base class, and
referred to as the derived class. That is,
ListBox derives its characteristics and
behaviors from Window and then specializes to its own particular
You’ll often see the immediate base class referred to as the
parent class, and the derived class referred to as the
child class, while the top-most class,
Object, is called the
In 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 : Window
This code declares a new class,
ListBox, that derives from
Window. You can read the colon as “derives
The derived class inherits all the members of the base class
(both member variables and methods), and methods of the derived class
have access to all the public and protected members of the base class.
The derived class is free to implement its own version of a base class
method. This is called
base class method and is accomplished by marking the method with the
new. (Many C# programmers advise never hiding base class methods as it is unreliable, ...