I am trying to understand the error I am receiving:
error: is implicitly deleted because the default definition would be ill-formed
Looking into why I am getting the error, I believe it has something to do with not having a default constructor for class Dealer. I'm not quite understanding why that is the case in regards to this program. I believe it has to do with the Motorcycle m_motorcycle object I created.
#include <iostream>
using namespace std;
class Motorcycle{
public:
string m_make;
string m_model;
int m_year;
Motorcycle(string, string, int);
};
class Dealer{
private:
Motorcycle m_motorcycles[3];
public:
void addMotorcycle(Motorcycle);
Motorcycle getMotorcycle(int);
};
int main(){
Motorcycle bike1("Ductai", "Scrambler", 2020);
Dealer dealer1;
dealer1.addMotorcycle(bike1);
return 0;
}
Motorcycle::Motorcycle(string make, string model, int year){
this->m_make = make;
this->m_model = model;
this->m_year = year;
}
void Dealer::addMotorcycle(Motorcycle bike){
this->m_motorcycles[0] = bike;
}