#include <iostream>
usingnamespace std;
class Rectangle {
int width, height;
public:
void setH(int h);
Rectangle::Rectangle():width(5),height(5) {}
int area(void) { return width * height; }
};
void Rectangle::setH(int h)
{
height = h;
}
void Changes(Rectangle*); // not sure if im passing the information correctly here
int main() {
Rectangle * baz;
baz = new Rectangle[2] ;
cout << "baz[0]'s area:" << baz[0].area() << '\n';
cout << "baz[1]'s area:" << baz[1].area() << '\n';
Changes(baz);
cout << "baz[0]'s area:" << baz[0].area() << '\n';
cout << "baz[1]'s area:" << baz[1].area() << '\n';
system("pause");
return 0;
}
void Changes(Rectangle*) // not sure if im passing the information correctly here
{
baz.setH(8); // this is my problem here. i dont know how to change the value in the baz[0] or baz[1]
}