Given the following code in gcc-4.8.1
struct Base
{
};
struct Derive : private Base
{
};
void fn(Base, int);
struct Conv
{
operator Base() const;
operator Derive();
};
int main()
{
Conv c;
fn(c, 0);
return 0;
}
When I gave above code, I got an error.I think compiler will select Conv::operator Base()
but actually the compiler selected Conv::operator Derive()
But when I gave the following code, the compiler selected Conv::operator Base()
struct Base
{
};
struct Derive// : private Base
{
};
void fn(Base, int);
struct Conv
{
operator Base() const;
operator Derive();
};
int main()
{
Conv c;
fn(c, 0);
return 0;
}