Is there any difference between parametrised constructor and conversion constructor. If so what is it?
Is there any difference between parametrised constructor and conversion constructor. If so what is
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A parameterised constructor is (presumably) any constructor that takes one or more parameters. A conversion constructor is a constructor that can be called with a single parameter and is not declared explicit.
Conversion constructors can be used by the compiler. Given:
the compiler can call this function as:
using the conversion constructor to convert 42 into an object of type A.