Here is the code
while connstructing the object of the calssCode:class Someclass { private: SomeOtherclass* p; public: Someclass() { p=new SomeOtherclass; } }
Someclass* sp= new Someclass;
first momory will be allocated to sp (here 4 byte as it only conatins a pointer to calss).Then Someclass's contructor will be called which will allocate memeory to p.If this fails, what will happen?
Momory allocated for sp will be leacked, right?
How are the way to chk this?
Thanks and regards!