fork download
  1. class A {
  2. public:
  3. class B {public: bool value;};
  4.  
  5. A() {
  6. DoStuff(b_);
  7. }
  8. B b_;
  9. private:
  10. virtual void DoStuffImpl(B& b) = 0;
  11. void DoStuff(B& b) { return DoStuffImpl(b); }
  12. };
  13.  
  14. class X : public A {
  15. // ...
  16. private:
  17. virtual void DoStuffImpl(B& b);
  18. void UseBForSomethingElse(B& b);
  19. };
  20.  
  21. void X::DoStuffImpl(B& b) {
  22. UseBForSomethingElse(b);
  23. }
  24.  
  25. void X::UseBForSomethingElse(B& b) {
  26. b.value = true;
  27. }
  28.  
  29. int main(){
  30. X x;
  31. return x.b_.value;
  32. }
Runtime error #stdin #stdout 0.01s 2720KB
stdin
Standard input is empty
stdout
Standard output is empty