Browse thread
[Q] Four micro-questions on objects and modules.
-
Christian RINDERKNECHT
-
Jerome Vouillon
- Christian RINDERKNECHT
-
Jerome Vouillon
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Christian RINDERKNECHT <rinderkn@h...> |
| Subject: | Re: [Q] Four micro-questions on objects and modules. |
Hello,
> > 3) Would it be possible to allow the "include" feature in class
> > types?
>
> What do you mean ? A class type can inherit from another class type :
> class type c = object method m : int end
> class type d = object inherit c method n : bool end
Okay. This is exactly what I was asking for. But... now I am a little
bit confused since I was used to think that inheritance was a concept
that applies to classes, and (sub)typing to class types. Could you
explain? (Please note I am new to these topics...)
It may be not related, but the toplevel does not print out the "inherit"
construct after the typing of the classes:
Objective Caml version 2.02
# class x =
object
method m = ()
end
;;
class x : object method m : unit end
# class y =
object
inherit x
method n = ()
end
;;
class y : object method m : unit method n : unit end
^^^^^^^^^^^^^^^
No "inherit x" used instead here...
Best regards,
--
Christian
-----------------------------------------------------------------------
Christian Rinderknecht Phone +33 (0)1 60 76 44 43
Institut National des Télécommunications Fax +33 (0)1 60 76 47 11
Département Logiciels Réseaux (LOR) WWW
9, Rue Charles Fourier, F-91011 Évry Cedex