Explain conversion functions, C/C++ Programming

Assignment Help:

Conversion Functions

Conversion functions are member functions used for the following purposes:

1. Conversion of object to basic data type.

2. Conversion of basic data type to object.

3. Conversion of objects of dissimilar classes.

Conversions of one basic data type to another are automatically done by the compiler using its own built-in routines (implicit) and it can be forced using built-in conversion routines (explicit). Though, since the compiler does not know anything about user-defined types (classes), the program has to explain conversion functions.

e.g.

                int i = 2, j =19;

                float f = 3.5;

                i = f;  // i gets the value 3 , implicit conversion

                f = (float) j; // f gets 19.00, explicit conversion

 


Related Discussions:- Explain conversion functions

C++ code??, Write a program to find the area under the curve y = f(x) betwe...

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

Pointers with an array, // Basic pointer code #include "stdafx.h" #in...

// Basic pointer code #include "stdafx.h" #include iostream using namespace std; int _tmain(int argc, _TCHAR* argv[]) {             int FirstNumber, SecondNumber;

Algorithm, What is an algorithm and write an algorithm to calculate the sim...

What is an algorithm and write an algorithm to calculate the simple interest

Araay, create two array names and grade .in first array you have to store t...

create two array names and grade .in first array you have to store thease 10 names 1.a,2.3.r,4.s,5.l,6.k,7.n,8.b,9.z,10.d you have to enter grades for thease students.te program mu

CptS 121 Program Development & Design program design in C, Write a program...

Write a program that performs character processing on 10 characters read in from a file, and writes the results to output files. Do NOT use loops or arrays to solve this problem. N

Describe how can i allocate/unallocate an array of things?, A: Use p = new ...

A: Use p = new T[n] and delete[] p:   Fred* p = new Fred[100]; ... delete[] p; Any time you allocate an array of objects through new (generally with the [n] in the n

Dll, i need amibroker afl to dll plugin

i need amibroker afl to dll plugin

Code, how to write c++ for function f(x)= 2x^3 -x^2 +10

how to write c++ for function f(x)= 2x^3 -x^2 +10

How to write a function template, How to write a function template A fu...

How to write a function template A function template should be written at the beginning of the program in the global area, or you may place it into a header file. All function

Amie, what happens when the following command is used? chmod u=rwx,go=r-x f...

what happens when the following command is used? chmod u=rwx,go=r-x foo

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