mber functions ](/w/cpp/language/member_functions "cpp/language/member
functions")  
[ Member access specifiers ](/w/cpp/language/access "cpp/language/access")  
[ Constructors and member initializer lists ](/w/cpp/language/constructor
"cpp/language/constructor")  
[ Default member initializer
](/w/cpp/language/data_members#Member_initialization "cpp/language/data
members") (C++11)  
[ ` friend ` specifier ](/w/cpp/language/friend "cpp/language/friend")  
[ ` explicit ` specifier ](/w/cpp/language/explicit "cpp/language/explicit")  
**Converting constructor**  
Special member functions  
[ Default constructor ](/w/cpp/language/default_constructor
"cpp/language/default constructor")  
[ Copy constructor ](/w/cpp/language/copy_constructor "cpp/language/copy
constructor")  
[ Move constructor ](/w/cpp/language/move_constructor "cpp/language/move
constructor") (C++11)  
[ Copy assignment operator ](/w/cpp/language/copy_assignment
"cpp/language/copy assignment")  
[ Move assignment operator ](/w/cpp/language/move_assignment
"cpp/language/move assignment") (C++11)  
[ Destructor ](/w/cpp/language/destructor "cpp/language/destructor")  
Inheritance  
[ Base and derived classes ](/w/cpp/language/derived_class
"cpp/language/derived class")  
[ Empty base optimization (EBO) ](/w/cpp/language/ebo "cpp/language/ebo")  
[ Virtual member functions ](/w/cpp/language/virtual "cpp/language/virtual")  
[ Pure virtual functions and abstract classes ](/w/cpp/language/abstract_class
"cpp/language/abstract class")  
[ ` override ` specifier ](/w/cpp/language/override "cpp/language/override")
(C++11)  
[ ` final ` specifier ](/w/cpp/language/final "cpp/language/final") (C++11)  
  
[ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/language/classes/navbar_content&action=edit)

A constructor that is not declared with the specifier [ explicit
](/w/cpp/language/explicit "cpp/language/explicit") and which can be called
with a single parameter  (until C++11)  is called a _converting constructor_ .

Unlike explicit constructors, which are only considered during [ direct
initialization ](/w/cpp/language/direct_initialization "cpp/language/direct
initialization") (which includes [ explicit conversions
](/w/cpp/language/explicit_cast "cpp/language/explicit cast") such as [
static_cast ](/w/cpp/language/static_cast "cpp/language/static cast") ),
converting constructors are also considered during [ copy initialization
](/w/cpp/language/copy_initialization "cpp/language/copy initialization") , as
part of [ user-defined conversion sequence ](/w/cpp/language/implicit_cast
"cpp/language/implicit cast") .

It is said that a converting constructor specifies an implicit conversion from
the types of its arguments (if any) to the type of its class. Note that non-
explicit [ user-defined conversion function ](/w/cpp/language/cast_operator
"cpp/language/cast operator") also specifies an implicit conversion.

Implicitly-declared and user-defined non-explicit [ copy constructors
](/w/cpp/language/copy_constructor "cpp/language/copy constructor") and [ move
constructors ](/w/cpp/language/move_constructor "cpp/language/move
constructor") are converting constructors.

###  [ [ edit
](/mwiki/index.php?title=cpp/language/converting_constructor&action=edit&section=1
"Edit section: Example") ]  Example

Run this code

    
    
    struct A
    {
        A() { }         // converting constructor (since C++11)  
        A(int) { }      // converting constructor
        A(int, int) { } // converting constructor (since C++11)
    };
     
    struct B
    {
        explicit B() { }
        explicit B(int) { }
        explicit B(int, int) { }
    };
     
    int main()
    {
        A a1 = 1;      // OK: copy-initialization selects A::A(int)
        A a2(2);       // OK: direct-initialization selects A::A(int)
        A a3{4, 5};    // OK: direct-list-initialization selects A::A(int, int)
        A a4 = {4, 5}; // OK: copy-list-initialization selects A::A(int,