The arrays can be used as member variables in a class. The following class definition is valid.
Const size = 10;
Class array
{
int a[size];
public:
void setval(void);
void display(void);
};
Const size = 10;
Class array
{
int a[size];
public:
void setval(void);
void display(void);
};
The array variable a[ ] declared as a private member of the class array can be used in the member functions like any other array variable. We can perform any operation on them. For instance, in the above class definition, the member functions setval( ) sets the values of elements of the array a [ ] and display( ) function displays the values. Similarly we may use other member functions to perform any other operations on the array values.
No comments:
Post a Comment