Conversion operator, C/C++ Programming

Assignment Help:

What is conversion operator? Explain it with example.


Related Discussions:- Conversion operator

C program to maintain database of employees, Aim: To implement a program t...

Aim: To implement a program to maintain information of employees in an educational institute using inheritance. Code:                       class staff {

Define the increment and decrement operators in c language, Define the Incr...

Define the Increment and Decrement Operators in c language? C offers two special operators -and ++ called decrement and increment operators respectively and these are unary ope

#Class objects, make use of class objects two calculate average

make use of class objects two calculate average

Law of motion, Ask question asdasasas#Minimum 100 words accepted#

Ask question asdasasas#Minimum 100 words accepted#

Quicksorting in linked lists, How do i write a code in C++ to bubblesort in...

How do i write a code in C++ to bubblesort in linked list

Described container class?explain types of container class, A container cla...

A container class is a class which is used to hold objects in external storage and memory. A container class work as a generic holder. A container class contains a predefined behav

Mini Search Engine, How do I create two functions: one to put a collection ...

How do I create two functions: one to put a collection of criteria into normal form, and one to compute the score of a document. A collection of criteria will be represented using

Explain access privileges, Access privileges 1. If the designer of the ...

Access privileges 1. If the designer of the base class needs no one, not even a derived class to access a member, then that member should be made private. 2. If the designer

Jack

2/13/2013 1:10:23 AM

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.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd