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

given the code segment below void main() { cout<<"my no. is"; } question is how can we get the output hai aravind my no. is 99999999999 without editig the main().

2 Answers  


I was a c++ code and was asked to find out the bug in that. The bug was that he declared an object locally in a function and tried to return the pointer to that object. Since the object is local to the function, it no more exists after returning from the function. The pointer, therefore, is invalid outside.

1 Answers  


what is pre-processor in C++?

1 Answers  


Explain binary search.

1 Answers  


What is the purpose of the noexcept keyword?

1 Answers  


What is the use of endl in c++ give an example?

1 Answers  


How do I tokenize a string in c++?

1 Answers  


What is oop in c++?

1 Answers  


Problem 6: Area of a trapezoid can be calculated by the following formula: A=(b1 b2)×h2 where b1 and b2 are the parallel sides or the bases and h is length of height Write a C code of this program

0 Answers   Maxobiz,


How do I run a program in notepad ++?

1 Answers  


Write a C++ program to sort digits of all the 4 digit number and display the sorted 4 digit number

1 Answers   TATA, TCS,


What are disadvantages of pointers?

1 Answers  


Categories