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

Buffer overflow, Can you help me with a C++ project?

Can you help me with a C++ project?

Explain processing a data file, Explain Processing A Data File? Mainly ...

Explain Processing A Data File? Mainly data file applications needs that a data file be altered as it is being processed. For instance in an application involving the processin

How the operations are performed in a single linked list, Question: (a)...

Question: (a) Explain a linked list. (b) Describe the three different types of linked list with the help of diagrams. (c) Give two advantages and two disadvantages

C++, #questAt a shop of marbles, packs of marbles are prepared. Packets are...

#questAt a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets wit

Employee salary, wap to read an employee salary and calculate DA,HRA,pf,GRO...

wap to read an employee salary and calculate DA,HRA,pf,GROSS,NET conditions:- BASIC DA HRA PF >10000 7% 9% 10% & >20000 9% 11% 15% &

File processing, Write a C++ program doing the following: The program reads...

Write a C++ program doing the following: The program reads from the keyboard the numbers of rows and columns of a 2-D array of integers. Then, it allocates this array (let’s name i

Explain the parts of operators, Explain the parts of operators Assignm...

Explain the parts of operators Assignment Operators The equal (=) sign is used for assigning a value to another. The left hand side has to be a variable (lvalue, which exc

Super ansii prgm, Ask quIn the Byteland country a string "s" is said to sup...

Ask quIn the Byteland country a string "s" is said to super ascii string if and only if count of each charecter in the string is equal to its ascci value in the byteland country as

3, Write a program to find the area under the curve y = f(x) between x = a ...

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

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