I
ishekar
Hi,
class A
{
public:
virtual void x(){cout<<"inside A"<<endl;};
}
class B : public A
{
private:
void x(){cout<<"inside B"<<endl;};
}
main
{
B b;
A& a=b;
a.x(); // this prints "inside B" but b's x() is a private method.
}
is this a compiler bug or a standard. i am not able to understand. could
anyone have a opinion on this.
Thanks
class A
{
public:
virtual void x(){cout<<"inside A"<<endl;};
}
class B : public A
{
private:
void x(){cout<<"inside B"<<endl;};
}
main
{
B b;
A& a=b;
a.x(); // this prints "inside B" but b's x() is a private method.
}
is this a compiler bug or a standard. i am not able to understand. could
anyone have a opinion on this.
Thanks