私は次の継承を持っています:
class A
{
void Configure(object param1) {...};
}
class B : A
{
void Configure(object param1) {...}; // The method is not defined in B, it is available from the base class. This is just the desired interface of class B
}
class C : A
{
void Configure(object param1, object param2) {...};
}
この場合、オブジェクトが不完全なままになるため、クラスCにparam1を使用したConfigureを表示させたくありません。
オーバーライドしようとしましたが、オーバーライドしても可視性を変更できません。
私が見つけた唯一のアプローチは、クラスAメソッドprotected void ConfigureBase(object param1) {...};
を呼び出し、クラスBのメソッドConfigureをConfigureBaseに呼び出すことです。
各クラスで再定義するため、この設計に完全に満足しているわけではないので、Configureはこれを処理する標準的な方法がありますか?