1).Why did I get this error? What is the correct syntax?
2).Is there a way to write the same code without using the library "vector"?
#include <vector>
myClass()
{
public:
myClass(int x,int y);
void doThis()
{
//Something
}
}
int main(void)
{
std::vector<myClass>*ex_vector = new std::vector<myClass(5,myClass{10,10});
ex_vector[0]->doThis(); //Error Here
delete []ex_vector;
}
I get this error:
error: base operand of '->' has non-pointer type 'std::vector<myClass>'