fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A
  5. {
  6. private:
  7. int a,b,c;
  8. public:
  9. virtual int get()=0;
  10. friend class B;
  11. };
  12.  
  13. class C:public A
  14. {
  15. int get(){
  16. return 0;
  17. }
  18. };
  19.  
  20. class B{
  21. public:
  22. void doSomething(C* c) {
  23. c->a = 1234567;
  24. }
  25.  
  26. };
  27.  
  28.  
  29. int main() {
  30. B b;
  31. b.doSomething(new C);
  32. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Standard output is empty