I need to set the 3 values in the House class which is derived from Dwelling class but it gives me the error that cannot call protected constructor
class Dwelling {
int bedrooms;
protected:
Dwelling(){bedrooms=0;};
Dwelling(int _b){bedrooms=_b;};
};
class House : public Dwelling {
int storeys;
bool garden;
public:
House() {storeys=0; garden=0;};
//constructor to set storeys, garden and bedrooms.
House(int st, bool val, int room){
if (st >= 1 || st <= 4) {
storeys = st;
garden = val;
Dwelling(room); // Gives me ERROR here
}
}
};
int main(){
House a(2, true, 3);
}