たとえば、基本クラスがあり、派生クラスで計算されるプロパティが必要です。2 つのバリアント (SomeProperty1
とSomeProperty2
) があります。
public class BaseClass
{
public int SomeProperty1{get;set;}
public override int SomeProperty2{get;set;}
}
public class DerivedClass : BaseClass
{
public DerivedClass()
{
SomeProperty1 = 100;
}
public override int SomeProperty2
{
get
{
return 100;
}
}
}
質問は、最善の方法は何ですか、SomeProperty1
またはSomeProperty2
?