fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. class A {
  6. public:
  7. A(int v) :
  8. value(v)
  9. {
  10.  
  11. }
  12.  
  13. int value = 0;
  14. };
  15.  
  16. class B : public A {
  17. public:
  18. B() : A(1) {
  19. cout << "value = " << value << endl;
  20. }
  21. };
  22.  
  23. int main() {
  24. A* obj = new B();
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
value = 1