I have a short question regarding Overruling the new and delete operator.
My Situation:
I have two classes A and B.
- A have a membervariable pointer to B (B *itsB;).
- Class B overrules new and delete to get Memory from my own static memory Pool
- A Constructor crate a new object of B
- A Destructor deletes the object of B
Now my Problem:
When I generate an Object of A, the depending B Object is generated correctly with the overruled new Operator.
When A is destructed the depending B Object DON'T calls my overruled delet function and the application crashs.
Im using VS2013.
I hope you understand my Problem and Thank You for Your help!
Show some code, a skeleton class B with the overloaded new and delete, a skeleton class A that dynamically allocates memory for it's B* member, and a main() that creates and destroys an object of A. Enough to compile the code and reproduce the error you noted. Also post any error messages you get.
"OVERRULE" is probably not the best way to think about this.