fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. class Bar
  6. {
  7. public:
  8. void Show() {cout << "showing\n";}
  9. };
  10.  
  11. class Foo
  12. {
  13.  
  14. public:
  15. Bar GetBar(){return bar;}
  16. Bar bar;
  17. };
  18.  
  19.  
  20. int main() {
  21. Foo foo;
  22. foo.GetBar().Show();
  23. foo.bar.Show();
  24. return 0;
  25. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
showing
showing