fork download
  1. class B {
  2. public:
  3. B() {
  4. a = new int[10];
  5. }
  6. ~B() {
  7. delete[] a;
  8. }
  9. private:
  10. int *a;
  11. };
  12.  
  13. class A {
  14. public:
  15. A(B& b): m_b(b) {}
  16. private:
  17. B *m_b;
  18. };
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1
2
10
42
11
compilation info
prog.cpp: In constructor 'A::A(B&)':
prog.cpp:15: error: cannot convert 'B' to 'B*' in initialization
stdout
Standard output is empty