Original Post
I have a general C plus plus question: What does happen when you are inside an object's method and the the object is deleted? Example: (corrected) I know it's not a good example since both classes have pointers to each other. But what would happen with the "obj1" object? Would the destructor be called? Would the DoSomething() function continue executing? Thank you for the help! [Edited by - aeroz on June 21, 2008 4:16:29 PM]
class Abc;
class Obj
{
public:
void DoSomething()
{
Abc->DeleteObj();
/* What now? */
}
Abc* blaBla;
};
class Abc
{
public:
Obj* obj;
void DeleteObj() { delete obj; }
};
int main()
{
Obj obj1;
Abc abc;
abc.obj = &obj1
obj1.blaBla = &abc
obj1.DoSomething();
}