What is a conversion constructor?



What is a conversion constructor?..

Answer / munendra kumar

A constructor that accepts one argument of a different type.

The compiler uses this idiom as one way to infer conversion rules for your class. A constructor with more than one argument and with default argument values can be interpreted by the compiler as a conversion constructor when the compiler is looking for an object of your constructor's type and sees an object of the type of the constructor's first argument.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

Write a program to interchange 2 variables without using the third one.

0 Answers  


Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == ) y-= 7; else y = 8; if the value of x is 4 before the nested IFs are executed, what is the value of y after the nested IFs are executed?

0 Answers  


Are vectors faster than arrays?

0 Answers  


What are the restrictions apply to constructors and destructors?

0 Answers  


Is c++ fully object oriented?

0 Answers  






sir i want to study the c++ course but ino what is the qualification and the study methode please reply more details in c++

1 Answers   NIIT,


What is enum class in c++?

0 Answers  


class X { public: int x; static void f(int z); }; void X::f(int y) {x=y;} What is the error in the sample code above? a) The class X does not have any protected members. b) The static member function f() accesses the non-static z. c) The static member function f() accesses the non-static x. d) The member function f() must return a value. e) The class X does not have any private members.

2 Answers   Quark,


Does c++ vector allocate memory?

0 Answers  


Explain the difference between static and dynamic binding of functions?

0 Answers  


What is the difference between = and == in C?

20 Answers   Christ University, Intel,


What are access specifiers in C++?

3 Answers  


Categories