这是“Date.h”类
class Date
{
private:
int day;
int month;
int year;
public:
void PrintDateV2();
Date(int, int, int);
~Date();
};
这是“Date.cpp”,指定功能的实现不起作用
void Date::PrintDateV2()
{
string months[12]={"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
/*line of error*/cout << months[month-1] << endl;//<< ":: " << day << ", " << year << endl;
}
这是错误列表中 Visual Studio 中的错误:
没有操作符 "<<" 匹配这些操作数操作数类型是:std::basic_ostream char, std::char_traits> << std::string