N
Nivvy
HI all,
I just wondered by seeing the o/p of the program. Let me know wt is the
reason.
class Base
{
public :
virtual void f1()
{
cout << "Base::f1() "<<endl;
}
};
class Derived : public Base
{
private:
void f1()
{
cout << "Derived::f1() "<<endl;
}
};
int main()
{
Base *bp = new Derived;
bp->f1();
return 0;
}
It ouputs the Derived private function.
What is the reason, whether this is like breaking OOPS.
-Nivvy
I just wondered by seeing the o/p of the program. Let me know wt is the
reason.
class Base
{
public :
virtual void f1()
{
cout << "Base::f1() "<<endl;
}
};
class Derived : public Base
{
private:
void f1()
{
cout << "Derived::f1() "<<endl;
}
};
int main()
{
Base *bp = new Derived;
bp->f1();
return 0;
}
It ouputs the Derived private function.
What is the reason, whether this is like breaking OOPS.
-Nivvy