How to stop conversions among objects?

Answers were Sorted based on User's Feedback



How to stop conversions among objects?..

Answer / vk

Using explicit keyword in the constructor

Is This Answer Correct ?    4 Yes 0 No

How to stop conversions among objects?..

Answer / kavitha

If any situation like that the constructor should build the
objects and should not get used for carrying out
conversions, In that situation we are required to use the
explicit keyword with the constructor.

Is This Answer Correct ?    1 Yes 0 No

How to stop conversions among objects?..

Answer / p.madhupriya

declare the duplicate operator.

Is This Answer Correct ?    0 Yes 0 No

How to stop conversions among objects?..

Answer / v.senthil kumaran

Declare operator function (dummy) for assignment operator
in the private section of the class.

Is This Answer Correct ?    0 Yes 2 No

How to stop conversions among objects?..

Answer / anupam deo

Use operator overloading

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More C++ General Interview Questions

What is a storage class in C++

1 Answers  


What are the restrictions apply to constructors and destructors?

0 Answers  


How much maximum can you allocate in a single call to malloc()?

0 Answers  


Tell me what are static member functions?

0 Answers  


What do you know about friend class and friend function?

1 Answers  






What are the conditions that have to be met for a condition to be an invariant of the class?

1 Answers  


Write a C++ program that asks the user to choose a number between 1 and 1000. Then, your program should be able to guess the number by asking the user no more than 10 yes/no questions. Use a while loop in your program

1 Answers  


Explain the need for "Virtual Destructor"?

2 Answers   Infosys,


What are stacks? Give an example where they are useful.

0 Answers  


How is memory managed in C++?

2 Answers  


What is realloc() and free()? What is difference between them?

1 Answers  


Can you write a function similar to printf()?

0 Answers  


Categories