class B { public: B() { a = new int[10]; } ~B() { delete[] a; } private: int *a; }; class A { public: A(B& b): m_b(b) {} private: B *m_b; }; int main() { B b; A a(b); }
Standard input is empty
prog.cpp:15:14: error: no viable conversion from 'B' to 'B *' A(B& b): m_b(b) {} ^ ~ 1 error generated.
Standard output is empty