fork(1) download
  1. #include <iostream>
  2.  
  3. class Foo {
  4. public:
  5. void f() {
  6. struct inner {
  7. void g(Foo& x) {
  8. x.h();
  9. }
  10. };
  11. inner obj;
  12. obj.g(*this);
  13. }
  14. private:
  15. void h() {
  16. std::cout << "Works!" << std::endl;
  17. }
  18. };
  19.  
  20. int main() {
  21. Foo foo;
  22. foo.f();
  23. }
Success #stdin #stdout 0.01s 2680KB
stdin
Standard input is empty
stdout
Works!