how could i get and set data on an array of objects? cant find a tutorial anywhere

so im looking into what this is...

class classname [6] is this an array of class objects?

if i wrote class classname [3] is that classname object number three or something else?

You would have gotten compilation errors.
Something like this should work.

class Classname

Classname Grade1[4];

This is declaring an array of type Classname, with four elements.

For more info: **This is the link to the full tut.

Hope it helps,
Last edited on
closed account (zb0S216C)
No, that's an array of 6 forward declarations of "classname", which isn't valid C++. A declaration of an array takes this form:

ClassName array_name[6]; // 6 "ClassName" objects. 

Accessing the array takes this form:

array_name[0] = ...;

The sub-script index is base-0, meaning that the index of the first element is 0, and the last is the array's
length - 1. An index is an offset from the first element that identifies different elements within the array.

Topic archived. No new replies allowed.