fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class B {
  5. public:
  6. void print() const { cout << prot << endl; }
  7. protected:
  8. int prot = 42;
  9. };
  10.  
  11. class D : public B {
  12. public:
  13. void mod(int v) { prot = v; }
  14. };
  15.  
  16. int main() {
  17. D d;
  18. d.print();
  19. d.mod(100500);
  20. d.print();
  21. return 0;
  22. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
42
100500