Browse thread
objects as method arguments
- micha
[
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: | micha <micha-1@f...> |
| Subject: | objects as method arguments |
I want to have the following: class c = object inherit base method m (arg : #base) = arg#do_something end;; this gives an error. Is the only way to get this working to write it that way? class c = object inherit base method m: 'a. (#base as 'a) -> unit = fun arg -> arg#do_something end;; If I have more of such methods, that looks rather ugly. Also I don't want to cast the argument-object to the baseclass type everytime... do I overlook something? cheers Michael