Hello, I am wondering if this is possible. If I have a parent class and a child that inherits the parent, the child can access a parents member function right? Well let's say we are in the parent member function that has just been accessed by a child. The program goes through some condition statements, comes true to a situation where it's true, and now needs to tell the child to do child member function x. Is that possible?
class parent{
doSomeChecks();
};
class child : public parent{
....
void xFunction();
void someFunction();
....
}
// =====================================
// the child function that calls a parent function doSomeChecks()
void child::someFunction(){
this->doSomeChecks();
}
// the parent function that has just been called by a child object.
void Parent::doSomeChecks(){
// this is where I want to call a child function from this parent class
// which has been called by a child object. Now how to call xFunction()?
}
// this function is the function I want to call from parent.
void child::xFunction(){
....
// do some work here
....
}
If anyone could shed some light on how and why this would or would not work would be super fantastic.
Thx.