Base Class Specification

Class declaration may contain a base class specification that determines a parent class and interfaces implemented by the class.

class-base:

:   class-type

:   interface-type-list

:   class-type   ,   interface-type-list

interface-type-list:

interface-type

interface-type-list   ,   interface-type

Base Class

If the base class specification includes the parent class declaration, this class becomes such for the determined class. Otherwise, Object is implied as the parent class.

A derived class inherits parent class members. Parent class scope cannot be less than the derived class scope. The following classes cannot be used as parent classes: System.Array, System.Delegate, System.MulticastDelegate, System.Enum and System.ValueType.

The base classes of a class are the parent class and its base classes. In other words, the set of base classes for a given one is the transitive closure of the direct inheritance relationship.

Every class has exactly one parent class, except for the Object class. The Object class does not have a parent class and is the ultimate parent class of all other classes.

When a class B derives from a class A, it is a compile error for A to depend on B directly or indirectly.

Interface Implementation

Base class specification may contain an interface types list. In this case it is said that the class implements the given interfaces. Interface implementation is described in the Interfaces section: Interface Implementation.

Example

Public Interface IUserClass
    Sub Test1();
    Function Test2(): integer;
End Interface IUserClass;

Class A
    Protected Sub Run();
    Begin
        //Procedure code
    End Sub;
End Class;

Class B: A, IUserClass
    Public Sub Test1();
    Begin
        //Procedure code
    End Sub Test1;
    Public Function Test2(): integer;
    Var
        Result: integer;
    Begin
        //Function code
        Return Result;
    End Function Test2;
End Class;

See also:

Classes