10 個の同じメンバーを共有する 2 つの異なるウィジェットがあります。ただし、2 つのステージもあります。各ステージには、他のステージにはない特定のメンバーがあります。
public class widget
private _id as integer
private _engravedId as string
private _stage as WidgetStage
private _wig as IWidget
end class
public interface IWidget
Calculate()
end interface
public class Twidget
implemets IWidget
private t as integer
private b as double
private d as double
end class
public class Rwidget
implemenents IWidget
private y as integer
private x as double
private b as double
end class
クラスで Iwidget を宣言すると、それをキャストして派生クラス変数にアクセスする必要があります。より良い方法はありますか?