[Issue 5056] Warning against virtual method call from constructor
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jun 5 07:53:36 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5056
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrej.mitrovich at gmail.com
--- Comment #12 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-06-05 07:53:35 PDT ---
(In reply to comment #11)
> dmd 2.063 - instance method is called before constructor.
There's a simple fix for this, simply call super() directly whenever you want
to:
class Derived : Base
{
this() { writeln("Derived.this"); super(); }
override void foo () { writeln("Derifed.foo"); }
}
Result:
Derived.this
Base.this
Derifed.foo
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list