fork(1) download
  1. #include <iostream>
  2.  
  3. struct Matrix
  4. {
  5. int i;
  6. int& operator() (int, int) { return i; }
  7. };
  8.  
  9. struct ChildMatrix : Matrix
  10. {
  11. ChildMatrix& operator() (int, int) { return *this; }
  12. };
  13.  
  14. int main() {
  15. ChildMatrix m;
  16. //m(1,1) = 1; //uncomment to get error
  17. ((Matrix&)m)(1,1) = 1;
  18. }
Success #stdin #stdout 0s 3292KB
stdin
Standard input is empty
stdout
Standard output is empty