class Base {
//private methods
void printMyType() {
cout << "this is base type" << endl;
}
//public methods
void printAllInfo() {
cout << "this An accout" << endl;
printMyType();
}
}; //end base class
class derived : public Base {
//private method
void printMyType() {
cout << "this is derived type" << endl;
}
//public methods
void printAllInfo() {
Base::PrintAccountInfo();
printMyType();
}
}; //end derived class
Ok i have the above methods! Its an assingment so the public and private methods visabilites cannot be altered.
Now when I call the printAllInfo() from the base class it prints out the following
"this An accout"
"this is base type""this An accout"
I want to write correct the printAllInfo() method in the derived class so that
when I call it it prints
"this An accout"
"this is a derived account"
so in other words when I call the printAllInfo method in derived class the printMyType() method overwirtes the one in the base class and prints "this is a derived account"
thanks
P.S Note the visibility etc is implemented in a header file! So dont take this code as being too literal but i gives a general idea of what I have and what I want.
P.P.S virtual methods is also not a possibility because the printAccountType() methods are both private
pls help