Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3455948
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:40:36+00:00 2026-05-18T09:40:36+00:00

Possible Duplicate: overloaded functions are hidden in derived class I have Class A and

  • 0

Possible Duplicate:
overloaded functions are hidden in derived class

I have Class A and Class B (subclass of A)

Class A has function

virtual void foo(int, int);
virtual void foo(int, int, int);

When I try to do

Class B with function

virtual void foo(int, int);

When I try to call foo(int, int, int) with the class the compiler won’t let me because it says

no matching function for foo(int,int,int)
candidate is foo(int,int);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T09:40:36+00:00Added an answer on May 18, 2026 at 9:40 am

    The reason why has to do with the way C++ does name lookup and overload resolution. C++ will start at the expression type and lookup upwards until it finds a member matching the specified name. It will then only consider overloads of the member with that name in the discovered type. Hence in this scenario it only considers foo methods declared in B and hence fails to find the overload.

    The easiest remedy is to add using A::foo into class B to force the compiler to consider those overloads as well.

    class B : public A {
      using A::foo;
      virtual void foo(int, int);  
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Why does Guava's ImmutableList have so many overloaded of() methods? Looking at
Possible Duplicate: Why are some operators in C++ only allowed to be overloaded as
Possible Duplicate: Best compiler warning level for C/C++ compilers? GCC has thousands of options
Possible Duplicates: Function overloading by return type? Puzzle: Overload a C++ function according to
Possible Duplicate: What is the meaning of a const at end of a member
Possible Duplicate: Where should non-member operator overloads be placed? While browsing on SO, I
Possible Duplicate: How do I check for nulls in an ‘==’ operator overload without
Lets say we have a 'default' theme for our Magento (1.4+) Shoe store, we
Possible Duplicates: Why are two different concepts both called “heap”? What's the relationship between

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.