Virtual Constructors

Defining the virtual constructors for your objects type is also a simple matter. Unlike the case of the serialisation routines, they can even be done inline in the class definition:

class foo: public object
{
 ...
 virtual object *lnew() {return vnew(this);}
 virtual object *lcopy() {return vcopy(this);}
};