How do I switch both parameters of the class to the object that I am creating? What is the syntax? (They must receive all the same parameters)
#include <iostream>
using namespace std;
class MyClass
{
public:
MyClass(int x,int y):value(x),value2(y)
{
//nothing
}
int value=10;
int value2;
};
int main()
{
MyClass ob1[5]; //Here! What is the correct syntax?
cout << ob1[0].value << endl;
return 0;
}
std::vectorhas a constructor to create N copies of something. It means an allocation and everything, though.