xpp {
/* define a class called XObj */
class XObj {
public:
/* define a member array called Arr */
int Arr[3] = {5,6,7};
void constructor() {
string Names[3] = {Jack,Jimmie,John};
int x;
/* loop through the elements of the Names[] array */
for (x = 0; x <= 2; x = x + 1) {
/* Write some text to the output stream */
xout("\r\nIn constructor this.Arr[" + x + "] = " + this.Arr[x]);
xout("\r\nIn constructor Names[" + x + "] = " + Names[x]);
};
};
};
/* define an array called a */
int a[3] = {10,20,30};
int x;
/* loop through the elements of a */
for (x = 0; x <= 2; x = x + 1) {
xout("\r\na[" + x + "] = " + a[x]);
};
/* instantiate an object MyObj of class XObj */
node(XObj) MyObj;
/* loop through the elements of the Arr array of the MyObj object */
for (x = 0; x <= 2; x = x + 1) {
xout("\r\nMyObj.Arr[" + x + "] = " + MyObj.Arr[x]);
};
}