inheritance C++ Preson Class

I have a problem. this code is not compilling. I have to make person class, then
with name and surname, then make Abonememt class, connect to person class and where we get three parameter. But How?

#include <iostream>
using namespace std;

class Person{
protected:
char* Name;
char* SurName;
public:
Person(char *Name, char* SurName){
Set(Name,SurName);
}
void Set(char *Name, char* SurName){
this->Name=Name;
this->SurName=SurName;
}
char *GetName(){
return this->Name;
}
char *GetSurName(){
return this->SurName;
}
};

class Abon:public Person{
protected:
int PhNum;
public:
Abon(char *Name, char *SurName, int PhNum){
Set(Name,SurName,PhNum);
this->PhNum=PhNum;
}
void Set(char *Name, char *SurName){
Person::Set(Name,SurName);
}
};

int main(int argc, char** argv) {
return 0;
}
Ca you please use the tags for code before the code, and after.

What errors do you get?
[Error] no matching function for call to 'Person::Person()'
error in Abon class, why it calls Person class,
Your set function only takes in 2 parameters, but you are inputing 3 parameters (Name,SurName,PhNum).
oh yes i changed it, but compilator is showing error, Abon constructor line is red
Your Abon cunstroctor should be

Abon(char *Name, char *Surname, int PhNum) : Person(Name, Surname), PhNum(PhNum) {}

Your Person constructor should be:

Person(char *Name, char* SurName) : Name(Name), SurName(SurName) {}
And after that i don't need Set function?
No, that is what your constructor is for :) The setFunction will be used to change those members outside of the class, after they are constructed.
Why do you have char instead of string for name and surname if i may ask?
My teacher told me to use char massive, to learn working on massive in class :D
Topic archived. No new replies allowed.