May 31, 2002 - Extending Base Classes | WebReference

May 31, 2002 - Extending Base Classes

Yehuda Shiran May 31, 2002
Extending Base Classes
Tips: May 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Inheritance is one of the major advantages of object oriented programming languages. When you have a class that provides most of the functionality you need, you can create a new class that is based on the existing class. The new class extends the functionality of the existing class, usually called the base class. The new class does everything the base class does, and more. Inheritance avoids duplication of code, promotes code reuse, cuts down the number of lines of code, and optimizes the maintenance burden.

The syntax for extending a base class is as follows:

  class NewClass extends BaseClass {
    [classmembers]
  }
where NewClass is the new class, BaseClass is the base class, and classmembers are the additional class members of the new class. They are added to whatever class members are defined in the base class.

To learn more about JScript .NET, go to Column 110, JScript .NET, Part IV: Inheritance.