Returning a class pointer from a function
Posted on 2011-02-13
I want to return a pointer to a class from a function. The instance of the class is created within the function that is to return the instance. So for example:
MyUDO *newUdo = new MyUdo();
. . .
There are many obvious problems I have run into so far including default copy constructor issues, scope problems, memory leaks and dangling pointer leaks to name a few.
So without getting into pedantic detail, I would like to know how can I make this happen?
Thanks very much.