fork(1) download
  1. #include <iostream>
  2.  
  3. struct TestStructure;
  4.  
  5. void TestFunction(TestStructure* /*unused*/) {
  6. std::cout << "Free TestFunction\n";
  7. }
  8.  
  9. struct TestStructure {
  10. int i;
  11. void TestFunction(TestStructure* /*unused*/) {
  12. std::cout << "TestStructure TestFunction\n";
  13. }
  14. void foo() {
  15. std::cout << "From foo\n";
  16. TestFunction(this);
  17. }
  18. };
  19.  
  20. int main() {
  21. std::cout << "From main:\n";
  22. TestFunction(nullptr);
  23.  
  24. TestStructure t;
  25. t.foo();
  26. }
  27.  
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
From main:
Free TestFunction
From foo
TestStructure TestFunction