fork(1) download
  1. #include <vector>
  2. using namespace std;
  3.  
  4. class Base {
  5. // ...
  6. };
  7.  
  8. class Derived1 : public Base {
  9. // ...
  10. };
  11.  
  12. class Derived2 : public Base {
  13. // ...
  14. };
  15.  
  16. int main() {
  17. vector<Base *> vector_of_pointers;
  18. vector_of_pointers.push_back(new Base());
  19. vector_of_pointers.push_back(new Derived1());
  20. vector_of_pointers.push_back(new Derived2());
  21. return 0;
  22. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty