怎么使类声明和成员函数分离
//student.hclass student
{
public:
student(int n):num(n){}
void display();
private:
int num;
string name;
char sex;
};
//student.cpp
#include <iostream>
#include "student.h"
void student::display()
{
cout<<"num"<<num;
}
为什么我写这个主函数会出现链接错误?
#include <iostream>
#include <string>
#include "student.h"
using namespace std;
int main()
{
student s(7);
s.display();
system("pause");
exit(1);
}
希望大家指教下小弟哈~!