错误:在第8行上的“ const”之前,预期的无限制ID



我一直在遇到此错误,我不知道为什么。请不要解释为什么这样的错误以及如何避免这种错误。这是用G

编译的

我的标题文件

#ifndef  _STUDENT_H 
#define  _STUDENT_H 
#include <string>
namespace name {
   class StudentRecord
{
private:
    std::string name;
    std::string surname;
    std::string studentNumber;
    std::string classRecord;
    int token;
public:
    StudentRecord(std::string  n , std::string s , std::string x , std::string c );
    StudentRecord(void);
    StudentRecord(const StudentRecord & rhs);
    StudentRecord(StudentRecord && rhs );
    ~StudentRecord();
    int avg(void);
    int aquire_token(void);
    void release_token(void);
};
}
#endif

*我的cpp文件如 *

#include <cstdlib>
#include <string>
#include "studentrecords.h"
namespace name{

// Copy Constructor
    // Error
StudentRecord(const StudentRecord & rhs)
{};
// Move Constructor


}

class Name前缀缺少:

// Copy Constructor
StudentRecord::StudentRecord(const StudentRecord & rhs)
{}

还请注意,您不需要;构造器实现后。

#include <cstdlib>
#include <string>
#include "studentrecords.h"
namespace name{

// Copy Constructor
StudentRecord::StudentRecord(const StudentRecord & rhs)<----//Change here....
{};
// Move Constructor
}

相关内容

最新更新