" ". , , . CPP , . . , , . , "", CPP .
InterfaceClass* InterfaceClass::Create()
{
return new ImplementationClass;
}
Thus, you effectively hide the implementation from any external user. However, you cannot create a class on the stack only on the heap ... but it really solves your problem AND provides a better level of abstraction. In the end, though, if you are not ready to do this, you need to stick to what you are doing.
source
share