By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,514 Members | 1,832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,514 IT Pros & Developers. It's quick & easy.

explicit keyword

P: n/a
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
Dec 11 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
George2 wrote:
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?
Have you tried googling?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Dec 11 '07 #2

P: n/a
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
Dec 11 '07 #3

P: n/a
On Mon, 10 Dec 2007 22:00:36 -0800 (PST) in comp.lang.c++, George2
<ge*************@yahoo.comwrote,
>I am reading the C++ Programming Language book, but can not find the
function of explicit keyword of constructor.
Section 11.7.1
Dec 11 '07 #4

P: n/a
George2 wrote:
Hello everyone,
I am reading the C++ Programming Language book, but can not find the
function of explicit keyword of constructor.
Have you tried the index?

--
Ian Collins.
Dec 11 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.