473,805 Members | 2,007 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error C2385: 'p2in1::Eject' is ambiguous

Hello guys,
I get compilation error [error C2385: 'p2in1::Eject' is ambiguous]
for the following code in MS VC++ 6 compiler:
I thought that if the Eject is called with no args, then the
Player::Eject ()
should be called.

But it is not working.
Please explain

#include <iostream.h>
class Player
{
public :
void Eject ()
{
cout << "player " ;
}
};

class CDPlayer : virtual public Player
{
public :
void Eject (int i){
cout << "CDplayer " ;
}
};
class Tape : virtual public Player
{
public :
void Eject (){
cout << "Tape player " ;

}
};
class p2in1 : public CDPlayer , public Tape
{

};
void main ()
{
p2in1 t1;

t1.Eject ();
}
Jul 22 '05 #1
1 2955
Prakru wrote:
Hello guys,
I get compilation error [error C2385: 'p2in1::Eject' is ambiguous]
for the following code in MS VC++ 6 compiler:
I thought that if the Eject is called with no args, then the
Player::Eject ()
should be called.
What about the method with the same signature in Tape. There is no
way a compiler can resolve between the two since the two are in the same
hierarchy.

But it is not working.
Please explain

#include <iostream.h>
class Player
{
public :
void Eject ()
{
cout << "player " ;
}
};

class CDPlayer : virtual public Player
{
public :
void Eject (int i){
cout << "CDplayer " ;
}
};
class Tape : virtual public Player
{
public :
void Eject (){
cout << "Tape player " ;

}
};
class p2in1 : public CDPlayer , public Tape
{

};
void main ()
{
p2in1 t1;

t1.Eject ();
}

--
Karthik.
Humans please 'removeme_' for my real email.
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1608
by: ALAN MEWS | last post by:
Hi, Hoping someone can help me. I'm fairly proficient in using MS Access 2000, but got the following problem and would very grateful for some advice as I am setting up (trying) this database for a charity: After successfully setting up buttons to open and close Forms, including a Query Form, a dialogue box suddenly pops telling me: The expression On Click you entered as the event property setting produced the following error: Ambiguous...
3
3744
by: Alexandre | last post by:
Hi! I receive this error in my webapp: Ambiguous match found. At line: Line 1: <%@ page language="C#" masterpagefile="~/memberscontents/master_interna.master" autoeventwireup="true" inherits="members_contents_user_profile, App_Web_user_profile.aspx.73f80179" title="Untitled Page" %>
7
14929
by: glen | last post by:
Hi. I'm using GCC 4.1.1, which I mention since I don't know if this is a compiler issue, or me not understanding some subtlety in the standard. The code below compiles fine under vc++, but I'm having trouble using gcc. It's just a templated container output. /** outputs elements of a vector in the form '{el1,el2...elEnd}'
5
2879
by: PLS | last post by:
I'm converting some C++ code to VC++ 2005 in native (non-managed) mode. This code doesn't use ATL, but codes the COM mechanisms directly. It has a class which is the equivalent of ATL's IDispatchImpl: template<class T> class CDispatch : virtual public IDispatch, virtual public CUnknown, private CDispatchBase { ...
11
3826
by: jakester | last post by:
I am using Visual C++ 2007 to build the code below. I keep getting linkage error. Could someone please tell me what I am doing wrong? The code works until I start using namespace for my objects. Error 1 error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char & __cdecl graph::operator<<(class std::basic_ostream<char,struct std::char_traits<char &,class graph::Node &)" (??6graph@@YAAAV?...
9
2205
by: neildferguson | last post by:
I am using templates with a little project I am working on. My compiler (GCC) is finding a particular construct ambiguous. Can anyone suggest something I might change in the declaration of class Length so that I can use operator+ the way I'd like? //========================================= // File lentest.h: #ifndef FDIMENS_LENGTH_INCL #define FDIMENS_LENGTH_INCL
11
4652
by: onkar | last post by:
#include<iostream> using namespace std; class Integer{ int i; public: Integer(int ii):i(ii){} const Integer operator+(const Integer& rv){ cout<<"1-operator+"<<endl; return Integer(i+rv.i); }
9
2203
by: sebastian | last post by:
I've simplified the situation quite a bit, but essentially I have something like this: struct foo { }; void bar( foo const & lhs, foo const & rhs )
8
5070
by: Anna Smidt | last post by:
lf.lfHeight = - (int) (fabs (pt.y) / 10.0 + 0.5) ; Error 1 error C2668: 'fabs' : ambiguous call to overloaded function ezfont.cpp 47 stasm I first thought that the compiler wants to fight with me because there where some decimals missing, but it's already .0 and .5. Also here an error "ambiguous call" is thrown...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10604
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10356
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10103
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7644
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3839
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.