1 / 1
Jan 2014

Hi!
I am unable to find error in this code. The program is supposed to take input from a student and display it after words. But I am getting following error when I try to compile, "Compiling NONAME00.CPP:Error NONAME00.CPP 46: Undefined symbol 'Person::Person()' in function Student::Student()". I am unable to figure out the exact fault, kindly help me out.

include

include

include

class Person
{
protected:
int id;
char name[50], address[100];

	public:
		Person()
			{
				id=0;
				name[0]='\0';
				address[0]='\0';
			}

	void Getinfo()
		{
			cout<<"Enter your id: ";
			cin>>id;
			cout<<"Enter your name: ";
			gets(name);
			cout<<"Enter your address: ";
			gets(address);
		}

	void ShowInfo()
		{
			cout<<"\n Youe Personal Information is as follows: \n";
			cout<<"id= "<<id<<endl;
			cout<<"Name= "<<name<<endl;
			cout<<"Address= "<<address<<endl;
		}

};

class Student : public Person
{
private:
int rno,marks;
public:
Student()
{
Person::Person();
rno=marks=0;
}

	void GetEdu()
		{
			cout<<"Enter your roll no. : ";
			cin>>rno;
			cout<<"Enter your marks : ";
			cin>>marks;
		}

	void ShowEdu()
		{
			cout<<"\n Your educational information is as follows : \n";
			cout<<"Roll No = "<<rno<<endl;
			cout<<"Marks = "<<marks<<endl;
		}
};

void main()
{
clrscr();
Student s;
s.Getinfo();
s.GetEdu();
s.ShowInfo();
s.ShowEdu();
getch();
}

Suggested Topics

Topic Category Replies Views Activity
C and C++ 0 15 8d

Want to read more? Browse other topics in C and C++ or view latest topics.