Help with Class

"Assume  a class  Window with a constructor  that accepts two integer  arguments : width and height (in that order). Declare  an array  named  winarr, consisting of 3 Window objects , where the first element  is an 80x20 window, the second a 10x10 window, and the third a 133x40 window."

I've been trying to go through my book but it doesn't say anything on arrays of objects, and i've been looking through the internet for some information on it too. I don't understand how to have two values set to one element of an array... The code below is what i've started. (this is for an online programming lab, i don't need to declare main or includes)
1
2
3
4
5
6
Class Window
{
Window(width, height)
Window winarr[];

};
Last edited on
you may be able to find a copy of herb schildt's "c++ for beginners" online in pdf format somewhere.. ms used to host it for a few years.toward the end of chapter 8.

you declare an array of objects the same way you declare an array of any variable. initialising them in the declaration is a bit tricky.
figured it out:

Window winarr[3] = {Window(80,20),Window(10,10),Window(133,40)};
Topic archived. No new replies allowed.