I have a program that has a custom class that I would like to create many of and access them like an array. Example:

#include <iostream>
using namespace std;

class Thing
             Thing(int value)
                  a = value;
             int doStuff(int diffValue)
                  a = diffValue + a;
             int a;

int main()
    Thing things(12)[100];
    return 0;

Obviously that will not work but is there an easy way to do this? I am not too familiar with pointers but if there is an easy way to use them in this case...
Thanks I'm open to any suggestions!

use vector

#include <vector>
int main()
    vector<Thing> things;
    Thing oneThing;
    // add OneThing to the vector


and you need a default constructor of the class too, since you have declared your own ctor the compiler will not generate it for you...

This question has already been answered. Start a new discussion instead.