Hi,
I made an class that requires passing 2 variables by default:
class TestClass
{
public:
TestClass(int, int);
~TestClass();
}
TestClass::TestClass(int a, int b)
{
}
TestClass:~TestClass()
{
}
now I need to create an dynamic array of TestClass, whats the best way to do this while still passing the 2 default variables?
int x = 15;
int v1 = 2;
int v2 = 3;
TestClass* t = new TestClass[x](v1, v2);
Are you sure about the "need"?
If you would not need "dynamic array", then:
std::vector<TestClass> t( x, TestClass(v1, v2) );