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 a program to find area of curve y=f(x) between x and x=b,integrate between the limits a and b using c     #include float start_point, /* GL


Area under the curve 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. The area under a curve bet

Protected derivation In addition to doing private and public derivations, you may also do a protected derivation. In this situation :   The private members inherited

Functions Overloading This a capability in which a C++ program can have several functions performing similar tasks on different data types. When an overloaded function is calle

Write a c++ program to find the sum of 0.123 ??103 and 0.456 ??102 and write the result in three significant digits

Ask question #M i want to undersatnd about tree structures like node leaf etcinimum 100 words accepted#

Write a C function to solve the system of linear equations A x = y where A is an N by N matrix in the format of pointer-to-pointers and y is a vector in the format of a pointer. Th

Object Initialization An object of a derived class can be initialized to an object of a base class. If both the classes have similar data members, then no specific constructor

#questiStarting with a blank solution, write a program to prompt the user for an employee number, hourly rate and hours worked. Compute and display the employee number, gross weekl