What is a conversion constructor?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain public, protected, private in c++?

571


What is object oriented programming (oop)?

625


Can we declare a base-class destructor as virtual?

588


What is istream and ostream in c++?

601


What parameter does the constructor to an ofstream object take?

620






How come you find out if a linked-list is a cycle or not?

573


How can you prevent accessing of the private parts of my class by other programmers (violating encapsulation)?

648


What are arithmetic operators?

546


the first character in the variable name must be an a) special symbol b) number c) alphabet

611


What are the uses of typedef in a program?

616


What is object in c++ wikipedia?

575


What data encapsulation is in c++?

601


What are the advantages of c++? Explain

602


What is encapsulation in c++ with example?

593


What does the linker do?

600