Confused about dangling pointers on a parent-child class[quote]Exactly. Dereferencing a dangling pointer leads to undefined behaviour so it's not safe to as...
Confused about dangling pointers on a parent-child class[quote]I just read your last post. So the if(true) is intentional then and designed to purposely tea...
Confused about dangling pointers on a parent-child class[quote]base is the dangling pointer (it points to an object that no longer exists).[/quote] Yes thi...
Confused about dangling pointers on a parent-child class[quote]Your if/else test it before the base and derived get destroyed. They both get destroyed at th...
Confused about dangling pointers on a parent-child class[quote]As a suggestion... // Destructor for BaseClass ~BaseClass() { delete[] da...
This user does not accept Private Messages