ご挨拶。私は次のクラスを持っています:
public class Ship
{
public enum ValidShips
{
Minesweeper,
Cruiser,
Destroyer,
Submarine,
AircraftCarrier
}
public enum ShipOrientation
{
North,
East,
South,
West
}
public enum ShipStatus
{
Floating,
Destroyed
}
public ValidShips shipType { get; set; }
public ShipUnit[] shipUnit { get; set; }
public ShipOrientation shipOrientation { get; set; }
public ShipStatus shipStatus { get; set; }
public Ship(ValidShips ShipType, int unitLength)
{
shipStatus = ShipStatus.Floating;
shipType = ShipType;
shipUnit = new ShipUnit[unitLength];
for (int i = 0; i < unitLength; i++)
{
shipUnit[i] = new ShipUnit();
}
}
}
私はこのクラスを次のように継承したいと思います:
public class ShipPlacementArray : Ship
{
}
意味あり。
私が知りたいのは、基本クラスの特定の機能を削除する方法です。
例えば:
public ShipUnit[] shipUnit { get; set; } // from base class
私はそれが欲しい:
public ShipUnit[][] shipUnit { get; set; } // in the derived class
私の質問は、基本クラスの shipUnit を完全に隠すコードをどのように実装するのですか?
そうしないと、派生クラスに 2 つの shipUnit 実装が作成されます。
お時間をいただきありがとうございます。
ShipPlacementArray は 1 つの船のみを扱います。ただし、配列は船を配置できる方向を反映しています。