I dont like this idea - who is responsible for deleting the classE object ?
ClassB my_classB;
my_classB.create; (I have the *ClassE filled with data )
myclassE_inside_A = my_classB.classE; // who owns the classE now ? this or my_classB
ClassC my_classC;
ClassC.set_classE(my_classE_insideA); // and now ? is ownership passed to my_classC ?
ClassB my_classB;
my_classB.create; (I have the *ClassE filled with data )
myclassE_inside_A = my_classB.classE; // who owns the classE now ? this or my_classB
ClassC my_classC;
ClassC.set_classE(my_classE_insideA); // and now ? is ownership passed to my_classC ?
To copy to clipboard, switch view to plain text mode
You can get lost here easily, passing around, modifying and storing pointer to an object created by temporary object (my_classB on stack) smells like crash sooner or later.
Free Heap block c977e28 modified at c977e5c after it was freed
I dont know who owns the created object, and it seems like you dont know either, because you want to access it after deleting it somewhere.
I gues you should rethink the design, because its not clear now, and will be very painful to modify and maintain this kind of code.
Bookmarks