Conversion operator, C/C++ Programming

Assignment Help:

What is conversion operator? Explain it with example.


Related Discussions:- Conversion operator

C program, program for lexicographically precedes the given input permutati...

program for lexicographically precedes the given input permutation

Should my class declare a friend function or member function, A: Use a memb...

A: Use a member while you can and a friend when you need to. Sometimes friends are better syntactically (e.g., in class Fred, friend functions let the Fred parameter to be secon

HASH., Define hash functions. Explain the Division method, Mid square metho...

Define hash functions. Explain the Division method, Mid square method and Folding method of hash functions.

Can you overload a function depend only on whether parameter, Can you overl...

Can you overload a function depend only on whether a parameter is a value or a reference? A: No. Passing by value and reference looks identical to the caller.

Illustrate the problems with multiple inheritance, Problems With Multiple I...

Problems With Multiple Inheritance The following example presents a problem with multiple inheritance. class Aclass  {   public :  void put()

Explain the process of using the constructor, Using the Constructor The...

Using the Constructor There are basically three ways of creating and initializing the object. The first way to call the constructor is explicitly as :

Palindrome, string S convert it to a palindrome by doing chara, C/C++ Progr...

string S convert it to a palindrome by doing chara, C/C++ Programming

Procedure to add two numbers in a recursive manner, (a) Write a procedure c...

(a) Write a procedure called (add x y) that adds two numbers in a recursive manner. Specifically, note that x + y = (x + 1) + (y - 1) and x + 0 = x. (b) Using the substitution m

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