Reputation:
I keep on getting this error, and I don't know why.Please won't someone explain why such a error is and how I can avoid such a error. This is being compiled with g++
My header file
#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
*My cpp file as stands *
#include <cstdlib>
#include <string>
#include "studentrecords.h"
namespace name{
// Copy Constructor
// Error
StudentRecord(const StudentRecord & rhs)
{};
// Move Constructor
}
Upvotes: 4
Views: 18010
Reputation: 2038
#include <cstdlib>
#include <string>
#include "studentrecords.h"
namespace name{
// Copy Constructor
StudentRecord::StudentRecord(const StudentRecord & rhs)<----//Change here....
{};
// Move Constructor
}
Upvotes: 0
Reputation: 43331
Class name prefix is missing:
// Copy Constructor
StudentRecord::StudentRecord(const StudentRecord & rhs)
{}
Note also that you don't need ;
after constructor implementation.
Upvotes: 9