I have the following files: Student.h and Student.cpp
// Student.h
namespace std
{
class Student
{
private:
char m_studentId[10];
char m_programCode[4];
public:
void getInfo(void) const;
void setInfo(const char *s, const char *p);
};
}
Student.cpp
// Student.cpp
#include <iostream>
#include <cstring>
#include "Student.h"
using namespace std;
namespace std
{
void Student::getInfo(void) const
{
cout << "Student ID: " << m_studentId << endl;
cout << "Program: " << m_programCode << endl;
}
void Student::setInfo(const char *s,const char *p)
{
strcpy(m_studentId, s);
strcpy(m_programCode, p);
}
}
The code actually compiles and runs quite successfully. However, Visual Studio is giving me the error:
declaration is incompatible with "void std::Student::setInfo(char *s, char *p)" (declared at line 10 of "Student.h").
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire