C
Christof Warlich
Hi,
I'm looking for an elegant way to do the following:
The classes DA1, ..., DAn are all derived from class A. The function
A *f(?????);
shall return a generalized pointer to an object of one of the derived
classes,
depending on the (to be defined) parameter being passed. If the requested
derived classes' object does not yet exist, it shall be created by the
function.
I certainly can do this by passing an enum to function f that enumerates
all possible derivations of class A, and instantiating or retrieving the
requested
object in a switch statement.
Any suggestions on how this could be done better?
Thanks and regards,
Christof
I'm looking for an elegant way to do the following:
The classes DA1, ..., DAn are all derived from class A. The function
A *f(?????);
shall return a generalized pointer to an object of one of the derived
classes,
depending on the (to be defined) parameter being passed. If the requested
derived classes' object does not yet exist, it shall be created by the
function.
I certainly can do this by passing an enum to function f that enumerates
all possible derivations of class A, and instantiating or retrieving the
requested
object in a switch statement.
Any suggestions on how this could be done better?
Thanks and regards,
Christof