#include using namespace std; class A { public: A(int); // non-explicit ctor }; class B { public: explicit B(int); // explicit ctor }; A::A(int) { cout << "A ctor called\n"; } B::B(int) // do not repeat keyword explicit { cout << "B ctor called\n"; } void funkA(A object) { cout << "funkA called\n"; } void funkB(B object) { cout << "funkB called\n"; } void funkAB(A obj) { cout << "funkAB(A) called\n"; } void funkAB(B obj) { cout << "funkAB(B) called\n"; } int main() { A objA(2); // instantiate an A object B objB(3); // instantiate a B object funkA(objA); // call funkA() with an exact argument match funkA(9); // call funkA() with an non-exact argument match funkB(objB); // call funkB() with an exact argument match // funkB(16); // error: cannot convert int to a B object funkAB(6); // compile error if B(int) is not explicit }