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
program area under the curve y=f(x) between x=a & y=b, integrate y=f(x) between the limits of a & b   Solution: #include float    start_point,            /* GLOBAL V

#write a multilevel c++ program to take marks of 3 subjects and calculate percentage and display it

(a) Write a recursive procedure (digits n) that computes the number of digits in the integer n using a linear recursive process. For example, (digits 42) should return 2 and (digit

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

Write a program that finds the minimum total number of shelv, C/C++ Programming

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 between two points can b

##question.A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string co   program in jav

#question:-program to counts tha no of occurances of the string in the nth padovan string

I need Profile and optimize a C++ library for speed Project Description: Optimize and profile an existing C++ library for speed. This library uses OpenMP and OpenCV and C+

Hi is there any chance to get assignment for fresher tutor