Working with Inheritance

Inheritance is the process of deriving one type from another, which promotes code reuse and makes it possible to use the huge selection of classes already written for you in the FCL. For example, the class System.Windows.Forms.Form, which you can base your own windows on, is a huge class. When you derive your own classes from that class, you're free to customize that class as you like, adding buttons, list boxes, check boxes, menus, and so on. (If you're already familiar with inheritance in a language like C++, you might just want to skim this discussion for the “For C++ Programmers” sidebars to see how C# differs from C++ here.)

A major part of inheritance involves polymorphism. Polymorphism means that you can provide ...

Get Microsoft® Visual C#® .NET 2003 Kick Start now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.