>>an option would be to use run-time polymorphism.
I thought about that too but dismissed it because it may not work. createandmanipulate() still has to know whether to allocate an object of type Class1 or Class2 before returning. If it allocates an object of only base then the caller will not get what it expects.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Offline 21,949 posts
since Aug 2005