spacepaste

code.ml (ocaml)

  1.  
  2. class virtual number: object ('a)
  3. method virtual value: 'b
  4. method virtual plus: 'a -> 'a
  5. end = object
  6. method virtual value: 'b
  7. method virtual plus: 'a -> 'a
  8. end
  9.  

error.txt

  1.  
  2. Error: The class type
  3. object method virtual plus : 'a -> 'a method virtual value : 'b end
  4. is not matched by the class type
  5. object ('a)
  6. method virtual plus : 'a -> 'a
  7. method virtual value : 'b
  8. end
  9. The method plus has type 'a -> 'a but is expected to have type
  10. (< plus : 'b; value : 'd. 'd; .. > as 'c) -> 'c as 'b
  11.