P
Prakru
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 ();
}
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 ();
}