1class type foo_t = 2 object 3 method foo: string 4 end 5 6type 'a name = 7 Foo: foo_t name 8 | Int: int name 9;; 10 11class foo = 12 object(self) 13 method foo = "foo" 14 method cast = 15 function 16 Foo -> (self :> <foo : string>) 17 end 18;; 19 20class foo: foo_t = 21 object(self) 22 method foo = "foo" 23 method cast: type a. a name -> a = 24 function 25 Foo -> (self :> foo_t) 26 | _ -> raise Exit 27 end 28;; 29