A method and system for implementing functions in a class that inherits an
interface and that inherits an implementing class which implements the
interface. A forwarding system adds to the class for each virtual
function a forwarding implementation of that virtual function. The
forwarding implementation forwards its invocation to the implementation
of that the virtual function in the implementing class. The forwarding
system implements a special forwarding instruction that specifies the
interface and implementing class. A developer of a class that inherits
the interface and the implementing class inserts the forwarding
instruction into the class definition. When the forwarding system
encounters such an instruction during compilation of the class
definition, the forwarding system provides an implementation of each
virtual function of the interface that forwards its invocation to a
corresponding virtual function in the implementing class. The forwarding
system also forwards virtual functions of any direct or indirect base
interface of the interface to the implementing class.