I have a class that looks as follow:
#include <string>
using std::string;
class cOb
{
private:
string var1;
int var2;
int var3;
public:
cOb(string v1, int v2, int v3);
};
cOb::cOb(string v1, int v2, int v3)
{
var1 = v1;
var2 = v2;
var3 = v3;
}
int main()
{
string x = "Somethin";
int y = 0, z = 10;
cOb object1(x,y,z);
}
but if I try to create an array of objects of this class as:
cOb aObjects[10]("" ,0 ,0 );
The compiler complains and give me this error:
error: bad array initializer
How can I create a default value so I don't have to initialize every object or how do I initialize this array in the correct way?