C++ 值未打印出来
我正在尝试打印这个使用派生函数的函数C++ 值未打印出来,c++,derived-class,C++,Derived Class,我正在尝试打印这个使用派生函数的函数 void Dairy::print(void){ cout << setw(20) << right << whoAmI() << setw(15) << right << this->getFat()<< setw(15) << right << this->getDatePurchased.getDay()<< se
void Dairy::print(void){
cout << setw(20) << right << whoAmI() << setw(15) << right << this->getFat()<< setw(15) << right << this->getDatePurchased.getDay()<< setw(15) << right << this->getExpireDate().getDate() << setw(15) << right << this->getCholesterol() << endl;
}
void乳制品::打印(void){
如果看不到类定义的其余部分,很难说。也许代码中有我们看不到的bug?请展示足够的信息,我们至少可以重现问题。始终包含完整的错误。猜测一下,this->getDatePurchased.getDay()
->this->getDatePurchased().getDay()
。您不需要此->
。请检查:以改进您的问题。