fork download
  1. #include<iostream.h>
  2. #include<conio.h>
  3.  
  4. class A;
  5.  
  6. class B
  7. {
  8. int b;
  9.  
  10. public:
  11.  
  12. B(){b=12;}
  13. void display(A x);
  14. };
  15.  
  16. class A
  17. {
  18. int a;
  19.  
  20. public:
  21. A(){a=10;}
  22. friend void B::display(A);
  23. };
  24.  
  25. void B::display(A x)
  26. {
  27. cout<<x.a<<b;
  28. }
  29.  
  30. int main()
  31. {
  32. A a1;
  33. B b1;
  34. b1.display(a1);
  35. getch();
  36. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:21: error: iostream.h: No such file or directory
prog.cpp:2:18: error: conio.h: No such file or directory
prog.cpp: In member function 'void B::display(A)':
prog.cpp:27: error: 'cout' was not declared in this scope
prog.cpp: In function 'int main()':
prog.cpp:35: error: 'getch' was not declared in this scope
stdout
Standard output is empty