Hi.
I was wondering if there is any possible way to do what I am about to describe in C++. And if there is - How?
I have a class lets call it A.
class A {
public :
virtual void mem1() =0;
virtual void mem2() =0;
};
I want to create another class B, which is derived from A(public), but I want to redefine a members function, so that it becomes something like this.
class B : public A {
public :
virtual void mem1()
{
//Add certain checks
//Then call mem1 (of it's derived class).
//Add some more checks
}
};
And now If I create a class C, which is derived from B and I alter the member function "mem1" (Since it's virtual). I still wants those checks to occur.
I know one way is the create a new pure virtual member function, and place it inside B's mem1 function, but is there any way I can do this without creating a new function (I basically want the new function to have the same name.)
I doubt, this is possible. But I just thought I should ask.
Any suggestions ?