fork download
  1. #include <iostream>
  2.  
  3. struct B
  4. {
  5. int x = 0;
  6. B() = default;
  7. B(int num) : x{num} {}
  8. };
  9.  
  10. struct D : B
  11. {
  12. using B::B;
  13. };
  14.  
  15. int main()
  16. {
  17. D a;
  18. D b(34); //error is coz of this line
  19. std::cout << a.x << std::endl;
  20. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
0