Я пытаюсь сделать несколько ООП в OCAML.
Вот два класса:
class virtual game_object id x y z =
object (self)
val id : int = id
val x : int = x
val y : int = y
val z : int = z
method get_x = x
method get_y = y
method get_z = z
end;;
class tile id x y z tile_type =
object(self)
inherit game_object id x y z as super
val tile_type : tile_type = tile_type
val w : int = 80
val h : int = 80
val box : Sdl.rect = Sdl.Rect.create super#get_x super#get_y w h (* This line triggers the error *)
method get_tile_type = tile_type
end
;;
Когда я пытаюсь скомпилировать, я получаю эту ошибку:
The instance variable super cannot be accessed from the definition of another instance variable
Понятия не имею, как решить эту проблему.Пожалуйста помоги?Спасибо.