class with header

this is a small program..but get so many errors...please anybody help me.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//person.h
class person
{
	private:
	int ID;
	char fname[20];
	char lname[20];
	char add[30];
	int age;
	
	public:
	person();
	person(int pID,char pfname[],char plname[],char padd[]);
	void printDetail();
	
};


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//person.cpp
#include<iostream>
#include"person.h"
#include<cstring>
using namespace std;

person::person()
{
	ID=0;
	strcpy(fname," ");
	strcpy(lname," ");
	strcpy(add," ");	
}

person::person(int pID,char pfname[],char pfname[],char padd[]);
{
	ID=pID;
	strcpy(fname,pfname);
	strcpy(lname,plname);
}
void person::prinDetail();
{
	cout<<"ID= "<<ID<<endl;
	cout<<"First Name - "<<fname<<endl;
	cout<<"Last Name  -"<<lname<<endl;
}




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

//pro.cpp
#include<iostream>
#include"person.h"
#include<cstring>
using namespace std;
int main()
{
	person p1(2,"Kamal","Perera","Kandy");
	p1.printDetail();
	
	person *p3;
	p3=new person(1003,"seetha","mendis","colombo");
	p3->printDetail();
	delete p3;
	return 0;
	
}
Can you copy and paste the errors you are getting?
//person.cpp

lines 15 and 21, remove the semicolon ; at the end of the line
Topic archived. No new replies allowed.