O'Reilly logo

Microsoft® Visual C#® 2008 Step by Step by John Sharp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Inheritance

This section covers the essential inheritance-related syntax that you need to understand in order to create classes that inherit from other classes in C#.

Base Classes and Derived Classes

The syntax for declaring a class that inherits from another class is as follows:

class DerivedClass : BaseClass {
    ...
}

The derived class inherits from the base class, and the methods in the base class also become part of the derived class. In C#, a class is allowed to derive from, at most, one other class; a class is not allowed to derive from two or more classes. However, unless DerivedClass is declared as sealed, you can create further derived classes that inherit from DerivedClass using the same syntax. (You will learn about sealed classes in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required