我有data.h
:
#ifndef DATA_H_INCLUDED
#define DATA_H_INCLUDED
#include <vector>
#include <string>
#include <iostream>
using namespace std;
class student{
public:
string id;
int points [6] = {0,0,0,0,0,0};
};
#endif // DATA_H_INCLUDED
我有enor.h
:
#ifndef ENOR_H_INCLUDED
#define ENOR_H_INCLUDED
#include <fstream>
#include <vector>
#include <string>
#include <iostream>
#include "data.h"
using namespace std;
enum status{norm,abnorm};
class enor{
public:
/*some voids*/
Student Current() const { return elem; }
student elem;
private:
/*some voids*/
};
#endif // ENOR_H_INCLUDED
我得到'Student' does not a name a type
,但为什么?如果Student
calss在enor.h
中,我也尝试了,但也是这个错误。我怎么解决这个问题,为什么会这样呢?
答案 0 :(得分:2)
您的student
课程的情况有所不同:
class student
- 小写s
Student Current() const
- 大写S