fork download
  1. #include <iostream>
  2. using namespace std;
  3. class xyz_helper
  4. {
  5. protected:
  6. int x;
  7. public:
  8. xyz_helper():x(0){}
  9.  
  10.  
  11. };
  12. class final_helper: public xyz_helper
  13. {
  14. public:
  15. final_helper(): xyz_helper()
  16. {
  17. }
  18. void set_and_print()
  19. {
  20. xyz_helper::x = 10;
  21. cout<<" value of x is "<<xyz_helper::x<<endl;
  22. }
  23.  
  24. };
  25.  
  26. int main() {
  27. final_helper obj;
  28. obj.set_and_print();
  29. // your code goes here
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
 value of x is 10