In article
<ea**********************************@e23g2000prf. googlegroups.com>,
George2 <ge*************@yahoo.comwrote:
Hello everyone,
I am reading the C++ Programming Language book, but can not find the
function of explicit keyword of constructor. Could anyone explain its
usage or refer some learning materials please?
thanks in advance,
George
The "explicit" keyword is defined in 12.3.1:
"An explicit constructor constructs objects just like non-explicit
constructors, but does so only where the
direct-initialization syntax (8.5) or where casts (5.2.9, 5.4) are
explicitly used."
In other words, implicit conversion of the constructor's parameter is
turned off when a constructor is declared explicit.
-dr