Apr 17, 2013 at 8:03pm
The syntax of accessing of an element of the vector is correct. It is incorrect the syntax of allocating new object of type MyClass. Should be
MyClass *example = new MyClass; // or MyClass()
Last edited on Apr 17, 2013 at 8:03pm
Apr 17, 2013 at 8:18pm
So if I have a constructor in the class:
Myclass(int a, string b, int c);
I would do the operation like this?
data.at(2).at(2).a = Myclass(1, abc, 2);
Apr 17, 2013 at 8:20pm
data.at(2).at(2).a = new Myclass(1, abc, 2);
Apr 17, 2013 at 8:22pm
Oh right, forgot about the new. Thanks.