Original Post
I''m reading The C++ Standard Library right now and don''t understand this snippet:
class ClassB {
private:
ClassA *ptr1;
ClassA *ptr2;
public:
//constructor that initializes the pointers will cause resource leak if second new throws
ClassB(ClassA val1, ClassA val2) : ptr1(new ClassA(val1)), ptr2(new ClassA(val2)) {}
//.........
};Why would it only be a resource leak if the second new thorws and not the first one?
