fork download
  1. class base (x, y) =
  2. object (self)
  3. val mutable _x = x
  4. val mutable _y = y
  5. method print = print_int (x + y)
  6. end;;
  7.  
  8. class derived x =
  9. let f x = (x + 1, x * 2) in
  10. object
  11. inherit base (f x)
  12. end;;
  13.  
  14. let a = new derived 1;;
  15. a#print;;
Success #stdin #stdout 0.01s 2780KB
stdin
Standard input is empty
stdout
4