Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. // Example program
  2. #include <iostream>
  3. using std::cout;
  4.  
  5. class B;
  6. class A {
  7. int age;
  8. B foo(); // even if undefined type 'B' is used by Value, not Reference of pointer,
  9. // this works.
  10. };
  11. class B : public A {
  12.  
  13. };
  14. B A::foo() {
  15. return B();
  16. }
  17. int main()
  18. {
  19. B b;
  20. cout << "compiled.\n";
  21. return 0;
  22. }
  23. /*
  24. Output:
  25. compiled.
  26. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement