digitalmars.D.bugs - [Issue 7850] New: Cannot call overloaded function from inherited class
- d-bugmail puremagic.com (45/45) Apr 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7850
- d-bugmail puremagic.com (15/15) Apr 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7850
http://d.puremagic.com/issues/show_bug.cgi?id=7850 Summary: Cannot call overloaded function from inherited class Product: D Version: unspecified Platform: x86_64 OS/Version: Windows Status: NEW Severity: minor Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: gaboonviper gmx.net --- Comment #0 from Boyd <gaboonviper gmx.net> 2012-04-07 11:40:07 PDT --- When a class overloads a function from its super class, the overloaded function cannot be found by DMD. Example: ------------------- import std.stdio; public class A { public int X = 12; public void DoSomething(int x) { writeln(x); } } public class B: A { public void DoSomething() { DoSomething(X); } } void main() { auto b = new B(); b.DoSomething(); } ------------------- This code causes the compiler error: function OverloadBug.B.DoSomething() is not callable using types (int). You can work around the problem by using super.DoSomething(X) instead. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 07 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7850 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-04-07 12:26:52 PDT --- The name visibility rules follow that of C++ - names in the super class are not visible if any by that name in the derived class exist. To overload them together, add the line: alias A.DoSomething DoSomething; -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 07 2012