fork download
  1. #include <iostream>
  2. #define TEST_CTOR_INHERITANCE 1
  3.  
  4. class Base
  5. {
  6. public:
  7. Base() { }
  8. Base(Base& other){ }
  9. Base(int value) { std::cout << "Base(" << value << ")\n"; }
  10. };
  11. class Derived : public Base
  12. {
  13. public:
  14. #if TEST_CTOR_INHERITANCE
  15. using Base::Base;
  16. #endif
  17. };
  18.  
  19. Derived a;
  20. Derived b(a);
  21. #if TEST_CTOR_INHERITANCE
  22. Derived c(42);
  23. #endif
  24.  
  25. int main()
  26. {
  27. }
  28.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
Base(42)