fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Base
  5. {
  6. public:
  7. int a, b;
  8.  
  9. Base() : a(1), b(1) { }
  10. Base(int _a, int _b) : a(_a), b(_b) { }
  11. };
  12.  
  13. class Derived : public Base
  14. {
  15. public:
  16. int c, d;
  17.  
  18. Derived() : c(10), d(10) { }
  19. Derived(int _c, int _d) : c(_c), d(_d) { }
  20. Derived(const Base&b):Base(b),c(10), d(10) {}
  21. };
  22.  
  23. int main()
  24. {
  25.  
  26. Derived d4(Base(2,2));
  27. }
  28.  
  29.  
Success #stdin #stdout 0s 4388KB
stdin
Standard input is empty
stdout
Standard output is empty