Hi All,
In my application i've 2 classes, a Base one (callaed Categorie) and a derived one (called CAT1). I create a vector of my custom class CAT1 and i tried to fill that vector with CAT1 elements using the push_back function:
Below are the declaration of my classes :
[Base Class]
class Categorie
{
public:
int ID;
string Fournisseur;
int Min;
int Quantite;
float Prix_Vente;
public:
Categorie(int ID, string Fournisseur, int Min, int Quantite, float Prix_Vente)
{
this->ID = ID;
this->Fournisseur = Fournisseur;
this->Min = Min;
this->Quantite = Quantite;
this->Prix_Vente= Prix_Vente;
}
Categorie(const Categorie & CSrc)
{
this->ID = CSrc.ID;
this->Fournisseur = CSrc.Fournisseur;
this->Min = CSrc.Min;
this->Quantite = CSrc.Quantite;
this->Prix_Vente= CSrc.Prix_Vente;
}
};
[End Base Class]
[Derived Class]
class CAT1: public Categorie
{
public:
string Utilite;
CAT1(int ID, string Fournisseur, int Min, int Quantite, float Prix_Vente, string Utilite):
Categorie(ID,Fournisseur, Min, Quantite, Prix_Vente), Utilite(Utilite){}
CAT1(const CAT1 & CSrc) : Categorie(CSrc), Utilite(CSrc.Utilite){}
};
[End Derived Class]
And here the lines that i wrote to fill the vector with elements if CAT1:
CAT1 * instance;
instance = AjoutCAT1();
CAT1Vct.push_back(instance);
When Compiling i got this error :
error C2664: 'push_back' : cannot convert parameter 1 from 'class CAT1 *' to 'const class CAT1 &'<br />
what's wrong and how fix it ?
Thank you.