我正在尝试声明一系列建筑物,但与每栋建筑物相关的楼层从未初始化。我想为与每个建筑物实例关联的每个楼层实例的数据成员提供值:
class Floor
{
public int number;
public int rooms;
//constructor
Floor()
{
rooms = 5;
number= 0;
}
}
class Building
{
public Floor[] floors= new Floor[6];
}
public partial class frmF2 : Form
{
Building[] x = new Building[7];
...
}