[Bug 91] Inherited classes require base class to have a default constructor.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 7 03:30:26 PDT 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=91
smjg at iname.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg at iname.com
Status|NEW |RESOLVED
Resolution| |INVALID
------- Comment #1 from smjg at iname.com 2006-04-07 05:30 -------
The compiler is correctly diagnosing an error. The derived class needs a base
class constructor to call. The keyword "super", when used in a constructor,
denotes a constructor of the base class.
class B : A {
this (int i) {
super(i);
}
}
If no call to super is present, then it looks for a default constructor and
calls that. Hence if there's no default constructor in the base class, then
you must call super when calling the derived class.
--
More information about the Digitalmars-d-bugs
mailing list