D
desktop
Are there some way to mix default and non-default parameters in a
constructor:
class test {
public:
test(int i = 45, int j) : pp(j){}
private:
int pp;
int i;
};
The above does not work and gives the error:
main.cpp:144: error: default argument missing for parameter 2 of
‘test::test(int, int)’
make: *** [main.o] Error 1
constructor:
class test {
public:
test(int i = 45, int j) : pp(j){}
private:
int pp;
int i;
};
The above does not work and gives the error:
main.cpp:144: error: default argument missing for parameter 2 of
‘test::test(int, int)’
make: *** [main.o] Error 1