fork download
  1. #include <iostream>
  2.  
  3. struct Foo
  4. {
  5. void foo() { std::cout << "Foo!!!\n"; }
  6. };
  7.  
  8. int main() {
  9. Foo(f0);
  10. f0.foo(); // OK, f is a Foo
  11.  
  12. //Foo f1;
  13. //Foo(f1); // ERROR: redeclaration of Foo f1
  14.  
  15. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
Foo!!!