First: I know my question is not about a parent class, but I don’t know how this structure is called and I thought parent would be the easiest to describe it.
I have two classes defined like this:
class class_a {
void foo() {
//stuff
}
};
class class_b {
class_a A;
void foo() {
//more stuff
}
};
I want class_b::foo(); called when certain requirements are met in class_a::foo(); It’s possible to just set a variable in class_a and check for it in class_b::foo(); but I was wondering if there is a more elegant solution to this.
note: class_b is and can not be derived from class_a.
Not sure I completely understand what you are trying to do, a more concrete example would be helpful, but perhaps this does what you want: