January 07, 2012 [Issue 7242] New: Cannot call base class member function with same name but diff parameters | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7242 Summary: Cannot call base class member function with same name but diff parameters Product: D Version: D2 Platform: Other OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: full.demon@gmail.com --- Comment #0 from Taco <full.demon@gmail.com> 2012-01-07 03:37:35 PST --- class A { public: void f(int i) { } } class B: A { public: void f() { } } int main() { B b = new B; b.f(1); } Error: function main.B.f () is not callable using argument types (int) Error: expected 0 arguments, not 1 for non-variadic function type void() -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 08, 2012 [Issue 7242] Cannot call base class member function with same name but diff parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Taco | http://d.puremagic.com/issues/show_bug.cgi?id=7242 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |INVALID --- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2012-01-07 22:45:58 PST --- This is by design. Overloads are done against functions in the current scope, not across all accessible scopes. You can pull the base class functions into the current scope by adding this line: alias A.f f; to B. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation