English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Basic quation about object methods
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-03-23 (11:57)
From: Jere Sanisalo <xm@x...>
Subject: [Caml-list] Basic quation about object methods

I'm a relatively newbie ocaml user, and I'm currently trying to understand a
basic thing about methods. Can someone clarify the following:

class test =
    val mutable v = 0
    method no_params = v<-v+1; print_int v
    method has_params () = v<-v+1; print_int v

Now what's the basic difference between methods "no_params" and
"has_params"? The o'reilly book says "Note that some methods do not need
parameters" and "We usually access instance variables with parameterless

Still both of these methods work just the same. 

Thanks for any info.

Jere Sanisalo [xm@xmunkki.org] - http://www.xmunkki.org/

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners