I was going through this post Default parameters with C++ constructors and I had a question regarding the placement of optional arguments in a constructor. For example:
Class TestCode {
private:
int _length;
int _width;
int _height;
public:
TestCode(int length = 5, int width, int height=3):
_length(length), _width(width),_height(height){
} } ;
// Using the class
TestCode testRectangle(2);
TestCode testRectangle2(2,3);
Is the testRectangle object constructed with width 2 and default length and height? What happens in the case of testRectangle2? Are the parameters assigned correctly. Given this ambiguity, should be just have all option parameters at the end of the constructor?