Here is a class
when we create an object of the Class MyClass by caling new, 1st new will allocate memory for the class.Then the constructor of MyClass will be called.Inside it, constructor of Someclass will be called.If constructor of SomeClass fails what will happen to memory allocated to MyClass object.Leak or not?Code:class MyClass{ private: SomeClass* sc; public: MyClass() { sc=new SomeClass; } };
Thanks in adv. for reply with regards,
-A