From: Jere Sanisalo <xm@xmunkki.org>
To: caml-list@inria.fr
Subject: [Caml-list] Basic quation about object methods
Date: Tue, 23 Mar 2004 13:57:49 +0200 [thread overview]
Message-ID: <20040323135747.A3439@xmunkki.org> (raw)
Hi,
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 =
object
val mutable v = 0
method no_params = v<-v+1; print_int v
method has_params () = v<-v+1; print_int v
end;;
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
methods.".
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
next reply other threads:[~2004-03-23 11:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-23 11:57 Jere Sanisalo [this message]
2004-03-23 13:35 ` Jacques Garrigue
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040323135747.A3439@xmunkki.org \
--to=xm@xmunkki.org \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox