Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #26160
| From | Joshua Cranmer <Pidgeot18@verizon.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Why “new”? |
| Date | 2011-02-05 10:32 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <iijqj4$7a4$1@news.eternal-september.org> (permalink) |
| References | (4 earlier) <iiiaia$5t9$1@lust.ihug.co.nz> <iiicja$epf$1@news.eternal-september.org> <iiihfu$9pf$1@lust.ihug.co.nz> <iiikcq$rp2$1@news.albasani.net> <iiirln$fh3$3@lust.ihug.co.nz> |
On 02/05/2011 01:45 AM, Lawrence D'Oliveiro wrote:
> Without understanding the C++ spec, you cannot understand what “virtual”
> means.
That is very arrogant of you. Especially since the JLS only uses the
word "virtual" (outside of the phrase "virtual machine") in §15:
The invocation mode, computed as follows:
If the compile-time declaration has the static modifier, then the
invocation mode is static.
Otherwise, if the compile-time declaration has the private
modifier, then the invocation mode is nonvirtual.
Otherwise, if the part of the method invocation before the left
parenthesis is of the form super . Identifier or of the form
ClassName.super.Identifier then the invocation mode is super.
Otherwise, if the compile-time declaration is in an interface, then
the invocation mode is interface.
Otherwise, the invocation mode is virtual.
[ ... ]
If class S contains a declaration for a non-abstract method named m with
the same descriptor (same number of parameters, the same parameter
types, and the same return type) required by the method invocation as
determined at compile time (§15.12.3), then:
If the invocation mode is super or interface, then this is the
method to be invoked, and the procedure terminates.
If the invocation mode is virtual, and the declaration in S
overrides (§8.4.8.1) X.m, then the method declared in S is the method to
be invoked, and the procedure terminates.
I might add that, in the JLS usage, private methods cannot be virtual
since any method with a private modifier is either static or nonvirtual.
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Why “new”? Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-02-05 13:53 +1300
Re: Why “new”? Arne Vajhøj <arne@vajhoej.dk> - 2011-02-07 19:01 -0500
Re: Why “new”? Ken Wesson <kwesson@gmail.com> - 2011-02-08 19:51 +0100
Re: Why “new”? Ken Wesson <kwesson@gmail.com> - 2011-02-08 12:33 +0100
Re: Why “new”? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-02-08 20:32 +0800
Re: Why “new”? Lew <noone@lewscanon.com> - 2011-02-05 09:07 -0500
Re: Why “new”? Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-02-05 16:51 +1300
Re: Why “new”? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-02-04 23:06 -0500
Re: Why “new”? Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-02-05 19:45 +1300
Re: Why “new”? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-02-05 10:32 -0500
Re: Why “new”? Lew <noone@lewscanon.com> - 2011-02-04 23:40 -0500
Re: Why “new”? Arne Vajhøj <arne@vajhoej.dk> - 2011-02-07 19:15 -0500
Re: Why “new”? blmblm@myrealbox.com <blmblm@myrealbox.com> - 2011-02-09 15:31 +0000
Re: Why ?new?? Owen Jacobson <angrybaldguy@gmail.com> - 2011-02-05 10:46 -0500
Re: Why “new”? Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-02-05 19:29 +1300
Re: Why “new”? Arne Vajhøj <arne@vajhoej.dk> - 2011-02-07 19:10 -0500
Re: Why “new”? Ken Wesson <kwesson@gmail.com> - 2011-02-07 04:45 +0100
Re: Why “new”? Ken Wesson <kwesson@gmail.com> - 2011-02-08 12:17 +0100
Re: Why “new”? Arne Vajhøj <arne@vajhoej.dk> - 2011-02-08 23:05 -0500
Re: Why “new”? Ken Wesson <kwesson@gmail.com> - 2011-02-08 19:49 +0100
Re: Why “new”? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-02-08 20:24 +0800
Re: Why “new”? Ken Wesson <kwesson@gmail.com> - 2011-02-07 09:18 +0100
Re: Why “new”? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-02-07 16:38 +0800
Re: Why “new”? Patricia Shanahan <pats@acm.org> - 2011-02-06 20:20 -0800
Re: Why “new”? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-02-07 11:27 +0800
Re: Why “new”? Lew <noone@lewscanon.com> - 2011-02-05 09:22 -0500
Re: Why “new”? Ken Wesson <kwesson@gmail.com> - 2011-02-07 04:17 +0100
Re: Why “new”? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-02-05 10:41 -0500
Re: Why “new”? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-02-05 10:38 -0500
Re: Why “new”? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-02-04 23:43 -0500
Re: Why “new”? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-02-05 09:31 -0400
Re: Why “new”? Daniele Futtorovic <da.futt.news@laposte.net.invalid> - 2011-02-05 18:43 +0100
Re: Why “new”? Arne Vajhøj <arne@vajhoej.dk> - 2011-02-04 20:05 -0500
Re: Why “new”? "Mike Schilling" <mscottschilling@hotmail.com> - 2011-02-04 17:33 -0800
Re: Why “new”? Lew <noone@lewscanon.com> - 2011-02-05 09:13 -0500
Re: Why “new”? Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-02-05 14:53 +1300
Re: Why “new”? Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2011-02-04 21:31 -0800
Re: Why “new”? Lew <noone@lewscanon.com> - 2011-02-05 01:25 -0500
Re: Why “new”? Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-02-05 14:24 +1300
Re: Why “new”? Lew <noone@lewscanon.com> - 2011-02-04 23:47 -0500
Re: Why “new”? Daniele Futtorovic <da.futt.news@laposte.net.invalid> - 2011-02-05 02:09 +0100
csiph-web