我也包含了身份的头文件,不知道为什么报错。
#pragma once
#include<iostream>
#include <string>
using namespace std;
class identity {
public:
virtual void opermenu() = 0;
string name;
string code;
};
学生.h的:
#pragma once
#include<iostream>
#include <string>
using namespace std;
#include"身份.h";
class student:public identity {
public:
student() {};
student(int c, string a, string b) {
number = c;
name = a;
code = b;
}
virtual void opermenu();
void order();
void sorder();
void saorder();
void corder();
int number;
};
#include行后面的分号去掉
不明确的意思就是有多个文件都包含同名类
身份类如果是你自己写的,那你最好把类的名字改掉
如果不是你自己写的,你可以把不相干的文件不要include进来
如果必须include,那你类名前面带上命名空间名字