クラスChildを継承しているクラスがありParentます。クラスParentには仮想保護メソッドがあり_parentClassMethod(int a, int b)ます。このメソッドは、クラスのメソッドで使用されChildます。
void Child::_childClassMethod(int c, int d)
{
//some code
_parentClassMethod(int a, int b);
//some more code
}
私の問題は次のとおりです。に、クラス_parentClassMethodから呼び出されたときに別の方法で実行する必要のある関数呼び出しがあります。私は空白にしていますが、クラスChild全体を再定義する以外に、それを行うためのより良い方法はありますか?_parentClassMethodChild
parentClassMethodの定義:
void Parent::_parentClassMethod(int a, int b){
//lots of other code
setSomethingFunction(val1, val2, val3);/*this function cannot be made virtual since it writes to the eeprom of a device*/
//lot more code
}