Ereditarietà
class point :
int ->
object val mutable x : int method get_x : int method move : int -> unit end
# class colored_point x (c : string) =
object
inherit point x
val c = c
method color = c
end;;
class colored_point :
int ->
string ->
object
val c : string
val mutable x : int
method color : string
method get_x : int
method move : int -> unit
end
# let p' = new colored_point 5 "red";;
val p' : colored_point =
# p'#color;;
- : string = "red"
Previous slide
Next slide
Back to first slide
View graphic version