I can set default value for integer even for string (for me string is the same array of char's), but why I can not set default value for array of integer of two,
for example:
class A
{
public:
A (int A=1, char *strName="Noname", int aI[2] = {-1,-1})
{
m_A = A;
m_strQName = strName;
m_aI[0] = aI[0];
m_aI[1] = aI[1];
}
~A();
private:
int m_A;
QString m_strQName;
int m_aI[2];
}
This one is not working.
But I want to initialize my object in constractor by this call:
A oA(2,"Line"
And I would like that m_aI[2] will be set by -1.
How can I do this?
Currently I deleted default values in constarctor arguments and set them in Constructor body. And I use other function to set user's values in my object, but I don't like it, bacause user of my class should make extra call.
Thank you.
for example:
class A
{
public:
A (int A=1, char *strName="Noname", int aI[2] = {-1,-1})
{
m_A = A;
m_strQName = strName;
m_aI[0] = aI[0];
m_aI[1] = aI[1];
}
~A();
private:
int m_A;
QString m_strQName;
int m_aI[2];
}
This one is not working.
But I want to initialize my object in constractor by this call:
A oA(2,"Line"
And I would like that m_aI[2] will be set by -1.
How can I do this?
Currently I deleted default values in constarctor arguments and set them in Constructor body. And I use other function to set user's values in my object, but I don't like it, bacause user of my class should make extra call.
Thank you.