&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&
#include<iostream>
using namespace std;
class A
{
int i;
virtual void f(){ cout<<endl<<"i= "<<i; }
public:
A(int j) { i = j; }
};
class B : public A
{
int j;
virtual void g() { cout<<endl<<"j= "<<j; }
public:
virtual void f(){ cout<<"I'm in B::f()"; }
B(int k):A(k+10){ j = k; }
};
int main()
{
A* a_base;
B* b_derived;
a_base = new B(1);
a_base->f();
}
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&
Hi,
In the above code the virtual function declaration in A is causing a
compiler error since its private. Does this mean that the virtual
function overring requires the base delaration also to be public.
Kindly explain...as i hadn't tried this earlier.
-praveen.