[
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: | Jacques Garrigue <garrigue@m...> |
| Subject: | Re: [Caml-list] adding methods to object |
From: "Jacques Le Normand" <rathereasy@gmail.com>
> is it possible to add methods to an object?
> in other words, if an object has type <a:b,c:d>, is it possible to create an
> object of type <a:b,c:d,e:f> ?
No, you can only add methods to classes.
The only thing you can do with an object is build a wrapper object or
class, which forwards original methods to the base object:
let wrap o =
object
method a = o#a
method c = o#c
method e = ...
end
Jacques Garrigue