<p>Given the following example, why do I have to explicitly use the statement <code>b-&gt;A::DoSomething()</code> rather than just <code>b-&gt;DoSomething()</code>?</p>

<p>Shouldn't the compiler's overload resolution figure out which method I'm talking about?</p>

<p>I'm using Microsoft VS 2005. (Note: using virtual doesn't help in this case.)</p>

<pre><code>class A
{
  public:
    int DoSomething() {return 0;};
};

class B : public A
{
  public:
    int DoSomething(int x) {return 1;};
};

int main()
{
  B* b = new B();
  b-&gt;A::DoSomething();    //Why this?
  //b-&gt;DoSomething();    //Why not this? (Gives compiler error.)
  delete b;
  return 0;
}
</code></pre>

The two “overloads” aren't in the same scope. By default, the compiler only considers the smallest possible name scope until it finds a name match. Argument matching is done
afterwards
. In your case this means that the compiler sees
```
B::DoSomething
```
. It then tries to match the argument list, which fails.
One solution would be to pull down the overload from
```
A
```
into
```
B
```
's scope:
```
```
class B : public A {
public:
    using A::DoSomething;
    // …
}
```
```