Virtual class

The run time type of a virtual class depends on the run time type of an object of the outer class.

(Just like the run time type of an object decides which virtual function should be used.)

Virtual classes solve the extensibility problem of extending data abstraction with new functions and representations.

The method can use the virtual classes of its arguments to create instances and declare variables.

Subclass Car would implement Parts differently than the subclass Bicycle, but the programmer can call any methods in the virtual inner class Parts on any class Machine object, and get the Parts implementation of that specific derived class.