getting this error in my code error: cannot convert 'Aircrafts' to 'Aircrafts*'
All I am trying to do is add a class record into a vector.
it is a c++ code and using -ansi -Wall -pedantic
it is bit annoying me. Hope somebody can help. Here is my code:
error is given for this line temp_aircraft = Aircrafts("Scenic", "Piper Arrow", 3, 120, 0, 0);
#include <iostream>
#include <string>
#include <stdlib.h>
#include <vector>
#include <iomanip>
using namespace std;
class Aircrafts
{
public:
string category;
string aircraft;
public:
Aircrafts () {
category = "";
aircraft = "";
}
Aircrafts (string f_cat, string airc) {
category = f_cat;
aircraft = airc;
}
}
void main()
{
vector <Aircrafts> aircraft_list;
Aircrafts *temp_aircraft;
temp_aircraft = new Aircrafts;
temp_aircraft = Aircrafts("Abc", "Xyz");
aircraft_list.push_back(*temp_aircraft);
}