As i'm c++ beginner the following Function Declaration and Definition couldnt understandable? so explain me what kind of Declaration this is......?
especially X& refers what?
Here instead of datatype X& is used. why?
Declaration :
private:
int len;
char *ptr;
public:
X& Set(char *);
Definition
X& X::Set(char *pc)
{
len = strlen(pc);
ptr = new char[len];
strcpy(ptr, pc);
return *this;
}
Also pleas explain *this without more complex technical terms.
especially X& refers what?
Here instead of datatype X& is used. why?
Declaration :
private:
int len;
char *ptr;
public:
X& Set(char *);
Definition
X& X::Set(char *pc)
{
len = strlen(pc);
ptr = new char[len];
strcpy(ptr, pc);
return *this;
}
Also pleas explain *this without more complex technical terms.
Comment