fork(4) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A {
  5. int a;
  6. public:
  7. A(int _a) : a(_a) {}
  8. friend int foo(A*);
  9. };
  10.  
  11. int foo(A* aa) {
  12. auto function = [](A* a) {
  13. return a->a;
  14. };
  15. return function(aa);
  16. }
  17.  
  18. int main() {
  19. A a(123);
  20. cout << foo(&a) << endl;
  21. return 0;
  22. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
123