ok could someone check it?
this is PERSON.h
Code:
#ifndef _PERSON_H_
#define _PERSON_H_
#include "Name.h"
using namespace std;
class Person: public Name
{
public:
Person(char *first, char *surname, State status) : Name(first,surname,status)
{};
void getAddress(void){};
};
#endif
this is PERSON.CPP
Code:
#include "Person.h"
#include "Name.h"
using namespace std;
void Person::getAddress(void) {
//nothing yet
}
this is NAME.h
Code:
#ifndef _NAME_H_
#define _NAME_H_
#include <iostream>
using namespace std;
class Name
{
public:
enum State { Teen, Child, Adult, Senior };
Name(){};
Name(char * firstname, char * surname, State status);
virtual void getAddress(void){};
protected:
char fn[80];
char sn[80];
State status_;
};
#endif
This is NAME.cpp
Code:
#include "Name.h"
using namespace std;
Name::Name(char * firstname, char * surname, State status)
{
strcpy(fn, firstname);
strcpy(sn, surname);
status_ = status;
}
this is MAIN.cpp
Code:
#include "Name.h"
#include "Person.h"
int main()
{
Person p("jack", "smith", Name::Child);
return 0;
}
and hte error is
Code:
/tmp/ccwoDlOf.o(.gnu.linkonce.t._ZN9PersonC1EPKcS1_N7State4statusE+0x1f): In function `Person::Person[in-charge](char const*, char const*, State::status)':
: undefined reference to `vtable for Person'
collect2: ld returned 1 exit status
make: *** [main] Error 1