I have a probably very simple question in C++. Let's say I have class defined as:
class PS { private:
int value; int m; public: PS(); PS(int value, int m); PS(int m); };
Now I want to define an array with elements of this type. For example,
PS t[3];
However, I want all of the elements in this array to have m=2. How would I do that? I am assuming I have to use inheritance some how, right? So for example I don't want to do something like this:
>PS t[3];
>t[0].PS(2);
>t[1].PS(2);
>t[2].PS(2);
I want to do it one show for all elements of t.
PS t[3](2,0);but I know that it's not valid (test.cpp:7:25: error: bad array initializer pair<int,int> T[3](0,0);).