[Issue 3790] New: [OOP] constructor of child class cannot pass arguments into parent constructor
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 9 18:16:32 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3790
Summary: [OOP] constructor of child class cannot pass arguments
into parent constructor
Product: D
Version: 2.041
Platform: x86_64
OS/Version: Linux
Status: NEW
Severity: blocker
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: denis.tomilin at gmail.com
--- Comment #0 from iorlas <denis.tomilin at gmail.com> 2010-02-09 18:16:32 PST ---
Constructor of child class cannot pass arguments into parent constructor.
See the example:
class A{
final this(int a=0){
writeln(a);
}
}
class B:A{
}
B b = new B(); //prints 0
B b2 = new B(2); //throws an error "expected 0 arguments, not 1..."
As we can see, logic is normal, but not in dmd. This bug creates a new bug:
class A{
final this(int a=0){
writeln(a);
}
}
class B:A{
this(int a=0){ //compiler perfectly, but parent constructor marked as "final"
super(a);
}
}
It might be not a hard problem, but it will be good for my project to create a
logical, nice-look code.
--
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