Conversion operator, C/C++ Programming

What is conversion operator? Explain it with example.

Posted Date: 2/13/2013 1:08:25 AM | Location : United States





Try this, it will definitely help you

Class can have a public method for particular data type conversions.

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. 

now conversion operator gets called to assign the value.

Posted by Jack | Posted Date: 2/13/2013 1:10:23 AM


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

Write discussion on Conversion operator
Your posts are moderated
Related Questions
Define the Increment and Decrement Operators in c language? C offers two special operators -and ++ called decrement and increment operators respectively and these are unary ope

how do i print out invalid input?

The #define Directive The #define directive explains a macro which is a text string represented by a name. Whenever the pre-processor finds this name in the program, it is repl

Rewrite the recursive bisection root finding function from lecture to be iterative (using a while loop). The function declaration should be root = bisectIter(f,a,b,tol). The input

Temperature Conversions. Problems 28 through30generate temperature-conversion tables. Use the following equations that give relationships between temperatures in degrees Fahrenheit

Project Description: I want someone who can post ads for me on Craiglist . I will pay 3$ per ad i need about 30-40 ads per day . Skills required: C Programming, MySQL, Jav

I want to change C++ code to Python extension Project Description: I have the C++ source code for an executable that takes a path to an image file as the input and prints tex

What is the use of PEAR in php? PEAR is termed as PHP Extension and Application Repository. It provides structured library to PHP users and also gives provision for package mai

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

overload assignment opertor to assign the data of one object to anthor