I have this class
class Dot
{
public: // Methods
Dot(); // Default Constructor
Dot (int dot [], int k); // Constructor
~Dot(); // Destructor
int getDot(); // Get Function
void setDot (int dot []); // Set Function
void PrintDot (); // Print Dot
private: // Attributes
int m_k;
int m_dot [];
};
And I want to write default constructor
Dot::Dot(): m_k(2), m_dot[] ({0,0}) // Compilation Error
Dot::Dot (int dot [], int k)
{
m_k=k;
m_dot [k]= dot [k];
}
but I don't know how to initialize the static array m_dot into the default constructor. It doesn't work ... I can't initialize it like constant because of the second constructor (possible to modify the value k and the array dot there)
Thanks
std::vector? The empty array syntax is not legal C++ anyway, at least in the context where you're using it.setDotfunction, as it probably alters the array in some way.