C++继承都错
#include <stdio.h>
#include <windows.h>
struct Person()
{
int age;
int sex;
};
struct teacher:Person // <==== 为什么语法不能通过
{
int age;
int sex;
int height;
int classID;
};
void main()
{
teacher t;
}
你的类定义错了
struct Person() //这里多了()了
{
int age;
int sex;
};
正确的
struct Person
{
int age;
int sex;
};
struct teacher:Person
{
///。。。。
肯定没有问题,另外,C++从未有过
void main()
这样的写法,ISO标准规定如此,C++发明者也声明过,你这么写,说明你用的是上世纪就淘汰的教程
上一篇:充电器头掰弯了
热门标签: