fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A {
  5. private:
  6. int k;
  7. public:
  8. A(): k(12) {
  9.  
  10. }
  11. void f()
  12. {
  13. cout << k;
  14. }
  15. };
  16.  
  17. class B: public A {
  18. public:
  19. int k;
  20. };
  21.  
  22. int main() {
  23. B b;
  24. b.f();
  25. // your code goes here
  26. return 0;
  27. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
12