Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dadas estas clases y objetos:
- class superclasesencilla(i0: int) =
- object
- val mutable i = i0
- method get = i
- method set i' = i<-i'
- end;;
- class subclasesencilla(i0: int)=
- object
- inherit superclasesencilla i0
- method swap i' = let v = i
- in (i<-i';v)
- end;;
- let objetillo=
- object(this)
- val mutable l = [0]
- method get = List.hd l
- method set i' = l <- [i']
- method swap i' = let v = this#get
- in(this#set i';v)
- end;;
- let f1 (o: <set: int->unit>) = 1+o#get
- let f4 (o:<set: int->unit; get: int>) = 1 + o#get;;
- let f6 = (o: <set: int->unit; get: int; ..>) = 1 + o#get;;
- let f8= (o:#superclasesencilla)=1+o#get;;
- let f10 (o: #superclasesencilla) = 1 + (o#swap 0);;
- let f12 (o: #subclasesencilla)= 1 + o#get;;
- ¿Es verdad o falso que las funciones f1 y f4 aceptan las mismas entradas?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement