Одна из моих ранних лаб:
class MainHouse
{
protected float width;
protected float height;
protected float length;
protected int floors;
protected int apartment;
protected int tenants;
public MainHouse()
{
width = 0;
height = 0;
length = 0;
floors = 0;
apartment = 0;
tenants = 0;
}
...
}
class Type2 : MainHouse
{
protected string st;
public Type2(float a1, float a2, float a3, string c1)
{
this.width = a1;
this.height = a2;
this.length = a3;
this.st = c1;
}
...
}
Тут всё нормально работает. Почему тут ошибка: BasicRoomNS.BasicRoom не содержит конструктор, который принимает 0 аргументов?
class BasicRoom
{
protected int numberOfFurniture;
protected int numberOfRooms;
protected int apartmentNumber;
protected int cost;
protected bool wifi;
public BasicRoom(int a, int b, int c, bool w) : base()
{
numberOfFurniture = a;
numberOfRooms = b;
apartmentNumber = c;
wifi = w;
}
class PremiumRoom : BasicRoom
{
protected bool bar;
public PremiumRoom(bool ba, int a, int b, int c, bool w) // Тут ошибка
{
this.numberOfFurniture = a;
this.numberOfRooms = b;
this.apartmentNumber = c;
this.wifi = w;
bar = ba;
}
}