From: Alan Schmitt <alan.schmitt@inria.fr>
To: Paul Stodghill <stodghil@cs.cornell.edu>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Duplicate methods - bug or feature?
Date: Thu, 23 Aug 2001 18:24:58 +0200 [thread overview]
Message-ID: <20010823182458.G1841@alan-schm1p> (raw)
In-Reply-To: =?iso-8859-1?Q?=3Cyz1pu9m92jw=2Efsf=40milhouse=2Ecs=2Ecornell=2Eedu=3E?= =?iso-8859-1?Q?=3B_from_stodghil=40cs=2Ecornell=2Eedu_on_jeu=2C_ao=FB_23?= =?iso-8859-1?Q?=2C_2001_at_12:14:11_-0400?=
You might consider it a feature, due to multiple inheritance. IIRC, when
a class inherits from two classes which define the same method name, the
last one wins.
Alan Schmitt
* Paul Stodghill (stodghil@cs.cornell.edu) wrote:
> Is it a bug or feature that a class can contain two methods with the
> same name? Thanks.
>
> milhouse$ uname -a
> CYGWIN_NT-5.0 MILHOUSE 1.3.2(0.39/3/2) 2001-05-20 23:28 i686 unknown
> milhouse$ ocamlc -v
> The Objective Caml compiler, version 3.02
> Standard library directory: /usr/local/lib/ocaml
> milhouse$
> milhouse$
> milhouse$ cat double_method.ml
> class a =
> object
> method m = "a.m1"
> method m = "a.m2"
> end
> ;;
>
> let _ =
> let x = new a in
> Printf.printf "x=%s\n" x#m;
> ()
> ;;
>
> milhouse$
> milhouse$
> milhouse$ ocamlc -o double_method.exe double_method.ml
> milhouse$ ./double_method.exe
> x=a.m2
> milhouse$
>
> -------------------
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
> To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
--
The hacker: someone who figured things out and made something cool happen.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-08-23 16:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-23 16:14 Paul Stodghill
2001-08-23 16:24 ` Alan Schmitt [this message]
2001-08-23 16:31 ` Paul Stodghill
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=20010823182458.G1841@alan-schm1p \
--to=alan.schmitt@inria.fr \
--cc=caml-list@inria.fr \
--cc=stodghil@cs.cornell.edu \
/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