explicit non-single parameter constructor
问题 Can anyone explain why does non-single parameter constructor marked as explicit compile? As far as I understand this is absolutely useless keyword here, so why does this compile without error? class X { public: explicit X(int a, int b) { /* ... */} }; 回答1: In C++03, and in this particular case, it makes no sense for a two parameter constructor to be marked explicit . But it could make sense here: explicit X(int i, int j=42); So, marking a two parameter constructor with explicit does not have