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
example of program to add two number

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

#include #include using namespace std; class Book { private: string title; int iD; int year_pub; string author; public: string getTitle(); int getId(); int getYear_Pub(); st

Define Character Input and Output with Files? This is done by using equivalents of putchar and getchar which are called putc and getc. Each one takes an extra argument which id

Write a program that takes 3 small letters as input and sort them according to their ASCII value.

Consider a group of n robots, numbered R2D1 through R2Dn, and m tasks, numbered 1 through m. Tasks can be different and robots are specialized, hence a given robot can only perform

Defines the entry point for the console application. // #include "stdafx.h" #include #include #include"conio.h" using namespace std; double Determinant(double a[][3],int forde

Explain the Bitwise-Inclusive-OR Operator: |? The bitwise-inclusive-OR operator (|) contrast each bit of its first operand to the corresponding bit of its second operand and if

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Develop a function to calculate sum of n even integers starting from a given even integer