June 8, 2002 - Multiple Inheritance of Interfaces | WebReference

June 8, 2002 - Multiple Inheritance of Interfaces

Yehuda Shiran June 8, 2002
Multiple Inheritance of Interfaces
Tips: June 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

A class can extend only one base class in JScript .NET. A class, though, may implement multiple interfaces. This is also called multiple inheritance. In JScript .NET, multiple inheritance is supported only for interfaces. Here are two interfaces:

  interface FirstInter{
    function printSomething();
  }
  interface SecondInter{
    function printSomething();
  }
The class myClass implements both of these interfaces, providing the body of the printSomething() function:

  class myClass implements FirstInter, SecondInter {
    function printSomething() {
      print("This is something else");
    }
  }
To learn more about JScript .NET, go to Column 110, JScript .NET, Part IV: Inheritance.