简单程序 编译不能通过
下面是一个简单的程序,我调试了很长时间,编译就是不能通过,哪位能指点一下?最好把错的地方标出来,谢谢//person.h--类定义#ifndef PERSON_H_
#define PERSON_H_
#include <cstring>
class Person
{
public:
Person()
{
lname=" ";
fname[0]='\0';
}
Person(const string & ln,const char *fn = "Heyyou")
{
lname=ln;
fname=fn;
}
void Show() const;
void FormalShow() const;
private:
enum{LIMIT=25};
string lname;
char fname[LIMIT];
};
#endif
//person.cpp--类实现
#include <iostream>
#include "person.h"
using namespace std;
void Person::Show() const
{
cout << fname << "," << lname << endl;
}
void Person::FormalShow() const
{
cout << lname << "," << fname << endl;
}
//useperson.cpp--使用类
#include <iostream>
#include "person.h"
int main()
{
Person one;
Person two("Smythecraft");
Person three("Dimwiddy", "Sam");
one.Show();
one.FormalShow();
two.Show();
two.FormalShow();
three.Show();
three.FormalShow();
return 0;
}