fork(3) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Blob
  6. {
  7. public:
  8. virtual void Echo() { cout << "timeless" << endl; }
  9. };
  10.  
  11. class Splat: public Blob
  12. {
  13. public:
  14. int age;
  15. Splat(int init): age(init) {}
  16. void Echo() { cout << age << endl; }
  17. };
  18.  
  19. int main()
  20. {
  21. Splat s(15);
  22. Blob* b;
  23. b = &s;
  24. b->Echo();
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
15