I've got an abstract class, CFractal, and two derived classes, CFractalMandel and CFractalJulia. I plan on adding several more in the future.
Well, in my main app i have a pointer to a CFractal which will point one of the two or more derived classes. Well, when the user does something (zooms in, in my case) I want to create a new object with the same type as the current pointer. So if my CFractal pointer points to a CFractalMandel, well then the new object should be of that class, or if its CFractalJulia well then of that type.
Both derived classes have the same constructors (they just pass paramaters along to the CFractal), and I dont want to have to resort to something like saying if *mainFrac->GetKindOfFractal == Mandel... if *mainFrac-<GetKindOfFractal == Julia...
Im doing this under MFC btw, if that helps at all.