easy, the function returns an address to a local variable that gets destroyed as the function
exits. it should be created in the heap by using the new
"cDriver D;" should be "cDriver D = new cDriver();"
but the user should remember to delete the returned pointer.
cheers!
Similar Threads |
|