DERIVED (prevent function overloading)

Top  Previous  Next

 

DERIVED

The DERIVED attribute of a PROCEDURE prototype specifies that the PROCEDURE on whose prototype it is placed is a VIRTUAL procedure. It can be used by itself or in addition to the VIRTUAL attribute on the prototype.

Use DERIVED to force a compile error when non-matching prototypes between a DERIVED virtual method and its PARENT are found. This prevents function overloading when a VIRTUAL method is the intention.

Example:

ClassA CLASS

Method1 PROCEDURE(LONG, <LONG>),VIRTUAL

      END

 

ClassB CLASS(ClassA)

Method1 PROCEDURE(LONG,<LONG>),DERIVED

      END

 

ClassC CLASS(ClassA)

Method1 PROCEDURE(LONG,<LONG>),VIRTUAL,DERIVED

      END

 

ClassD CLASS(ClassA)

Method1 PROCEDURE(STRING),DERIVED  !Will produce compiler error:

      END                         !must match parent prototype

See Also:

CLASS

VIRTUAL