The following code, in a combination of class B class A, will be given operation,
class A { public: A(int _a) { a = _a; cout << "构造函数" << "a" << a << endl; } ~A() { cout << "析构函数" << "a" << a << endl; } protected: private: int a; }; class B { public: protected: private: int b1; int b2; A a2; A a1; }; void obj10play() { A a1(10); B ojbB; return ; } void main() { obj10play(); system("pause"); }
Error rooted to allocate memory Class B, Class A as it contains a member variable part,