#include <iostream>
using namespace std;
#include<string>
class Time {
public:
Time(int h, int m, int s)
{
hour = h;
minute = m;
second = s;
}
void display() {
cout << "出生时间" << hour << "时" << minute << "分" << second << "秒" << endl;
}
protected:
int hour, minute, second;
};
class Date {
public:
Date(int y, int m, int d) {
year = y;
month = m;
day = d;
}
void display() {
cout << "出生年月" << year << "年" << month << "月" << day << "日" << endl;
}
protected:
int year, month, day;
};
class Birthtime : public Time, public Date {
_public:
Birthtime( string name, int ye, int mo, int da, int hou, int min, int se)
:Time(ye, mo, da), Date(hou, min, se)
{
Childrename = name;
}_
void display() {
cout << "姓 名" << Childrename << endl;
Date::display();
Time::display();
}
protected:
string Childrename;
};
int mian() {
Birthtime nb("张三", 2002, 12, 16, 9, 23, 26);
nb.display();
return 0;
}
两个错误
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 LNK2019 无法解析的外部符号 _main,函数 "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ) 中引用了该符号 ProjecTime Date 派生Birthtime D:\c++题\ProjecTime Date 派生Birthtime\MSVCRTD.lib(exe_main.obj) 1
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 LNK1120 1 个无法解析的外部命令 ProjecTime Date 派生Birthtime D:\c++题\ProjecTime Date 派生Birthtime\Debug\ProjecTime Date 派生Birthtime.exe 1
int mian()
改为
int main()
=======
main函数名都写错了啊