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

Project Description: We want to generate premium numbers for one of our application. What we need is: A program that generate 2, 3, 4, 5, 6, 7, 8 digits premium numbers

program that decodes sending smuggler''s string

Define the Recursion Function in C? In C, it is potential for the function to call themselves a function is describing 'recursive' if a statement within the body of a function

#At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with the

Write a function for finding out highest and lowest marks obtained by a student from an array contained student name and marks. For Example : GetHighestLowestMarks{Student{n}, Ma

program to find if a no . is prime or not


Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Class Templates In addition to function  templates, C++  also supports the  method of class templates. By definition, a class template is a class definition that explains a fam