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
In this assignment you are required to develop a program that allows the creation, viewing and storage of information about ITECH7603 Students. In order to complete the task you ha

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.   #include float start_poin

how to find the volume of cone , cylinder and sphere ?

Program to Open a file in C++: int main() {                  char ch;                  ifstream f1 ("OLDFILE.TXT");                  ofstream f2 ("NEWFILE.TXT");

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

write a function that take as parameters an array of integer and its size and return the sum of its value

Binary Options EA for DirectFX and SignalPush Project Description: I want a programmer who will build an EA based on my three types of Binary strategy's using two Indicators.

one of the applications of computers in numerical analysis is computing the area under a curve. one method of calculating the area under acurve is to divide the area int a number o

- But with less features and more user-friendly (particularly for non-tech savvy users). - Software needed having a left menu with links (no pictures required) for every hardwar

Q: Name the operators which cannot be overloaded? A:sizeof, ., .*, .->, ::, ?: