D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7242 - Cannot call base class member function with same name but diff parameters
Summary: Cannot call base class member function with same name but diff parameters
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-07 03:37 UTC by Taco
Modified: 2012-01-07 22:45 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Taco 2012-01-07 03:37:35 UTC
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()
Comment 1 Walter Bright 2012-01-07 22:45:58 UTC
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.