I want to "cout" every aparat that is bigger than vm but i don't know how to solve this error: 'class AparatElectronic' has no member named 'v_max'|
class AparatElectronic
{
public:
AparatElectronic(string firma_p,int pret);
virtual ~AparatElectronic();
virtual void afisare();
virtual void vol(AparatElectronic *v[],int k);
protected:
string Firma_P;
int Pret;
private:
};
class blender:virtual public AparatElectronic
{
public:
blender(string firma_p,int pret,int v_max);
virtual ~blender();
void afisare();
virtual void vol(AparatElectronic *v[],int k);
protected:
int V_max;
private:
};
class masina_de_macinat_rosii:virtual public AparatElectronic
{
public:
masina_de_macinat_rosii(string firma_p,int pret,int nr_cutite);
virtual ~masina_de_macinat_rosii();
void afisare();
virtual void vol(AparatElectronic *v[],int k);
protected:
int Nr_cutite;
private:
};
class Robot_de_bucatarie:virtual public blender,virtual public masina_de_macinat_rosii
{
public:
Robot_de_bucatarie(string firma_p,int pret,int v_max,int nr_cutite,string culoare);
virtual ~Robot_de_bucatarie();
void afisare();
virtual void vol(AparatElectronic *v[],int k);
protected:
string Culoare;
private:
};
AparatElectronic::AparatElectronic(string firma_p,int pret)
{
this->Firma_P=firma_p;
this->Pret=pret;
}
AparatElectronic::~AparatElectronic()
{
//dtor
}
void AparatElectronic::afisare()
{
cout<<this->Firma_P<<" "<<this->Pret<<endl;
}
blender::blender(string firma_p,int pret,int v_max):AparatElectronic(firma_p,pret)
{
this->V_max=v_max;
}
blender::~blender()
{
//dtor
}
void blender::afisare()
{
cout<<this->Firma_P<<" "<<this->Pret<<" "<<this->V_max<<endl;
}
masina_de_macinat_rosii::masina_de_macinat_rosii(string firma_p,int pret,int nr_cutite):AparatElectronic(firma_p,pret)
{
this->Nr_cutite=nr_cutite;
}
masina_de_macinat_rosii::~masina_de_macinat_rosii()
{
//dtor
}
void masina_de_macinat_rosii::afisare()
{
cout<<this->Firma_P<<" "<<this->Pret<<" "<<this->Nr_cutite<<endl;
}
Robot_de_bucatarie::Robot_de_bucatarie(string firma_p,int pret,int v_max,int nr_cutite,string culoare):AparatElectronic(firma_p,pret),blender(firma_p,pret,v_max),masina_de_macinat_rosii(firma_p,pret,nr_cutite)
{
this->Culoare=culoare;
}
Robot_de_bucatarie::~Robot_de_bucatarie()
{
//dtor
}
void Robot_de_bucatarie::afisare()
{
cout<<this->Firma_P<<" "<<this->Pret<<" "<<this->V_max<<" "<<this->Nr_cutite<<" "<<this->Culoare<<endl;
}
couldn't reproduce your error
make sure that you are compiling the last version
also, when posting code post a complete example.
I don't want to have to fix your includes and namespaces.
edit: unless that was actually your error...
missing
1 2
|
#include <string>
#include <iostream>
|
at the top and the std:: prefix when refering classes, objects and functions from the std namespace.
Last edited on