Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > name lookup ambiguity

Thread Tools

name lookup ambiguity

George2 George2 is offline
Senior Member
Join Date: Feb 2008
Posts: 108
Hello everyone,

The following code will result in compile error below is because of private method of base class is also considered into name lookup, even if we can not access directly the private method of base class?

error C2385: ambiguous access of 'foo'

class Base
     void foo() {}
     void bar() {}

struct Mixin { void foo() {} };

class Derived: public Base, public Mixin
     void bar() { foo(); }   // Uh oh.

int main()

thanks in advance,
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
procedure call name vs.association_list ambiguity root VHDL 2 07-12-2012 08:36 AM
rmi lookup name can't use hostname? Java 2 03-17-2006 11:18 AM
Template name lookup C++ 10 03-22-2005 07:03 AM
access and name lookup, surprised by this code John Harrison C++ 9 02-22-2004 07:34 AM
Default arguments, object sharing, name lookup and others Maciej Sobczak Python 5 12-23-2003 09:33 AM