* objects as method arguments
@ 2007-05-02 23:04 micha
0 siblings, 0 replies; only message in thread
From: micha @ 2007-05-02 23:04 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-05-02 23:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-02 23:04 objects as method arguments micha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox