Hi all,
I'm trying to declare a data member of a class as char (array type) and then want to use it outside the class as well. I may use it by getter function but 'm not declaring it properly, I think. Any help, please?
Code:class color
{
private:
int code;
char color[25];
public:
color()
{
code=0;
color[0]='\0';
}
void setCd(int cd)
{ code = cd; }
int getCd()
{ return code; }
void setCl(char cl[])
{ color[] = cl[]; }
char getCl()
{ return color; }
void input()
{
int cod=0; char clr[25];
cout << "Code: "; cin >> cod;
cout << "Color: "; cin >> clr;
setCd(cod); setCl(clr[]);
}
~color()
{ }
};