Define conversion operator?, C/C++ Programming

Define conversion operator??

Posted Date: 3/15/2013 5:14:19 AM | Location : United States





Define conversion operator??

A: class can have a public method for specific data type conversions. For instance:

class Boo

{

double value; public: Boo(int i )

operator double()

{

return value;

}

};

Boo BooObject;

double i = BooObject; // assigning object to variable i of type double. conversion operator now gets called to assign the value.

 

 

Posted by | Posted Date: 3/15/2013 5:14:59 AM


Related Discussions:- Define conversion operator?, Assignment Help, Ask Question on Define conversion operator?, Get Answer, Expert's Help, Define conversion operator? Discussions

Write discussion on Define conversion operator?
Your posts are moderated
Related Questions
write an algorithm for linear search algorithm

Important Note: No course works, which have been submitted via hard copies or emails, will be accepted a short essay below edited in a document (word, other) files with

Create the following program or propose one of your own. The program must include at least one of each of the following. Decision structure Repetitive structure fu

Define  C o ns t a n t a r g u me n t : T h e a r gu m e n t c a n b e a c on s t a n t a r gu m e n t .    T h e c o


#include #include #include #include #include //*Variables Used in Programs*// int k; int l; int d; int won; int loss; int cash = 500;

Write a program to sort an array of strings. Use new and delete operators. Write a program to find the factorial of a number using recursion. If we do not accept the number

We started off taking about input, output, CPU and memory devices. Within C we need a method of storing large amounts of data in memory. We have used the idea of variables (pointer

Define Bitwise-AND Operator: &:? The bitwise-AND operator (&) compares every bit of its first operand to the corresponding bit of its second operand. If both bits are 1 the mat

Create a .cpp program that verifies the strength of a password that a user is entering is strong (complex/secure) enough. In the main area of the program, prompt the user to enter