initial version - for testing new OO bytecodes like GETPUBMET GETDYNMET
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6361 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
9d19bcf441
commit
1253881474
|
@ -0,0 +1,26 @@
|
|||
(**** file testinterp/t301-object.ml
|
||||
suggested by Jacques Garrigue to Basile Starynkevitch
|
||||
|
||||
compilable with
|
||||
ocamlc -nostdlib -I ../../stdlib \
|
||||
../../stdlib/pervasives.cmo ../../stdlib/camlinternalOO.cmo \
|
||||
t301-object.ml -o t301-object.byte
|
||||
|
||||
***)
|
||||
(* $Id$ *)
|
||||
|
||||
|
||||
class c = object (self)
|
||||
method pubmet = 1
|
||||
method privmet = self#pubmet + 1
|
||||
val o = object method a = 3 method m = 4 end
|
||||
method dynmet = o#m
|
||||
end;;
|
||||
|
||||
let f () =
|
||||
let c = new c in
|
||||
(c#pubmet, c#privmet, c#dynmet);;
|
||||
|
||||
ignore (f ());;
|
||||
|
||||
(**** eof $Id$ *)
|
Loading…
Reference in New Issue