On Wed, 10 Apr 2013 11:48:18 +0100, Dicebot <[email protected]> wrote:
My understanding as based on dlang.org:
On Wednesday, 10 April 2013 at 10:29:05 UTC, Regan Heath wrote:
Ok, lets Rewind for a sec. I need some educating on the actual issue
and I want to go through the problem one case at a time..
#1 If I write a class..
class A
{
public int isVirt() { return 1; }
public int notVirt() { return 2; }
}
and compile it with another class..
class B : A
{
override public int isVirt() { return 5; }
}
and this main..
void main()
{
A a = new B();
a.isVirt(); // compiler makes a virtual call
a.notVirt(); // but not here
}
Right?
No.
Hmm..
A is not final.
True. But, I don't see how this matters.
A has no internal linkage. It can be inherited from in other compilation
unit.
False. In this first example we are compiling A and B together (into an
exe - I left that off) so the compiler has all sources and all uses of all
methods of A (and B).
notVirt is virtual.
It may actually be (I don't know) but it certainly does not have to be
(compiler has all sources/uses) and my impression was that it /should/ not
be.
R
--
Using Opera's revolutionary email client: http://www.opera.com/mail/