Jump to content

C++ Language/Objects/Constructors/InitializationByOneParameterConstructor

From Wikibooks, open books for an open world

A one-parameter-constructor is essentially converting the type of some data (from that parameter's type, into this class type). To prevent client code from unintentionally doing this type-conversion when that client uses implicit-initialization syntax, mark this constructor definition with the explicit keyword.

Additional information about a one-parameter-constructor (includes interactive examples)