I'm a little confused about the second constructor. I would have assumed that the parameters to the constructor would overshadow the instance variables and thus that this initialization would not work. It seems to work correctly though. Can someone explain why this works? Also is this considered bad practice?
class Box {
private:
int l;
int b;
int h;
public:
Box(): l(0), b(0), h(0) {} // this I understand
Box(int l, int b, int h): l(l), b(b), h(h) {} // why does this work?
};