这是问题所在:
在控制台.cpp
void Console::PrintMedicine(Medicine* m){
int ID = Medicine.getID(); //here i get the error expecting primary expression before "." token, it doesn't work with -> either
cout<<"The Medicine's ID is: ";
cin>>ID;
}
医学类:
什么是私人的:
private:
int ID;
std::string nume;
double concentratie;
int cantitate;
什么是公开的
public:
Medicine(); //implcit constructor
Medicine(int ID, std::string nume, double concentratie, int cantitate);//constructor with parameteres
~Medicine(); //destructor
//获取ID函数
const int& Medicine::getID() const{
return this->ID;
}
//getName函数
const std::string& Medicine::getName() const{
return this->nume;
}
//获取浓度函数
const double& Medicine::getConcentration() const{
return this->concentratie;
}
//getQuantity 函数
const int& Medicine::getQuantity() const{
return this->cantitate;
}