[Cs3] explicit specifier

Mikhail Nesterenko mikhail at cs.kent.edu
Thu Feb 8 17:07:22 EST 2018


CS3 students,

There was a question at or after the class about explicit specifier
for a constructor. Explicit specifier prohibits using a constructor in
situations where it "might" work.

For example,

    explicit B(int) {.....}

Would prohibit using the above constructor in this statement:

     B b1 = 55; 

Here are more details:

  http://en.cppreference.com/w/cpp/language/explicit

Thanks,
-- 
Mikhail


More information about the cs3 mailing list