Please note, the
C++
keyword is
private
, all lowercase.
General speaking you provide the such accessors this way:
class A
{
int a;
public:
int get(){return a;}
void set(int n){a=n;}
};
I chose a
int
data member
on purpose, because direct handling of char pointers is a bit tricky (for instance do you need a copy of the string or what?) and probably you'll better use
std::string
instead.