#include <iostream>
using namespace std;
class MyClass {
int h;
int i;
public:
MyClass(int j, int k) {
h = j;
i = k;
}
int getInt() {
return i;
}
int getHeight() {
return h;
}
};
int main()
{
MyClass myObject[3] = {
MyClass(1, 2), // initialize
MyClass(3, 4),
MyClass(5, 6)
};
int i;
for(i=0; i<3; i++) {
cout << myObject[i].getHeight();
cout << ", ";
cout << myObject[i].getInt() << "\n";
}
return 0;
}
|