首页 > 解决方案 > 值未打印出来

问题描述

我正在尝试打印这个使用派生函数的函数。

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;
}

该错误表明必须调用对非静态成员的引用。错误可能是什么?

标签: c++derived-class

解决方案


推荐阅读