Here I am trying to make a subclass of the base class, Airplane. In my main code I haven't tried to use either constructor yet as I am just trying to make sure I can make the subclass Fighter to properly work.
The exact error its giving me is
no matching function for call to 'Airplane:Airplane()'
And says it pertains to this line of code in the Fighter.cpp
Fighter::Fighter(int engi, int seat, string description)
Fighter.cpp
#include "Fighter.h"
Fighter::Fighter(int engin, int seat, string description)
{
fNumEngines = engi;
fNumSeats = seat;
rangeAndSpeedDesc = description;
}
Fighter.h
#include "Airplane.h"
using namespace std;
#ifndef FIGHTER_H_
#define FIGHTER_H_
class Fighter:public Airplane {
private:
int fNumSeats;
int fNumEngines;
string rangeAndSpeedDesc;
}
Airplane.cpp
#include "Airplane.h"
using namespace std;
Airplane::Airplane(int engines, int seats)
{
numSeats = seats;
numEngines = engines;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…