#include <iostream>
#include <string>
using namespace std;
class Month
{
public:
Month(string Mon=0);
Month(int n=0);
void show();
Month next();
private:
int mon;
};
#include "Month.h"
int main()
{
cout << "请输入月份值或英文简写:";
Month m1(int);
Month m1(string);
cout << m1.show();
system("pause");
return 0;
}严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C2228 “.show”的左边必须有类/结构/联合 D:\C++实验\第四周\ex2\ex2\ex2.vcxproj D:\C++实验\第四周\ex2\ex2\main.cpp 7
怎么改呀,既要实现重载,又要实现输入任意的整数或字符串,求帮忙
Month m1(int);
Month m1(string);
变量重定义了
你的意思没有说明白。你现在是要输入一个整数和一个字符串,把他们分别显示出来?
还是要对输入的数判断是整数还是字符串。然后用不同构造函数?