How many types of casting are there in C++?
When is a dynamic cast,static_cast,reinterpret cast used?
Answer Posted / berzerk
Casting Operators
There are several casting operators specific to the C++ language. These operators are intended to remove some of the ambiguity and danger inherent in old style C language casts. These operators are:
dynamic_cast Used for conversion of polymorphic types.
static_cast Used for conversion of nonpolymorphic types.
const_cast Used to remove the const, volatile, and __unaligned attributes.
reinterpret_cast Used for simple reinterpretation of bits.
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is the use of volatile variable?
Is swift faster than c++?
How one would use switch in a program?
What is encapsulation in c++?
the maximum length of a character constant can be a) 2 b) 1 c) 8
What is null pointer and void pointer?
what does the following statement mean? int (*a)[4]
What do you mean by function and operator overloading in c++?
What is class in c++ with example?
What does the nocreate and noreplace flag ensure when they are used for opening a file?
What are stacks?
When does a 'this' pointer get created?
Write a program to find the reverse Fibonacci series starting from N.
What are the methods of exporting a function from a dll?
A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a saleperson who sells $5000 worth of merchandise in a week receives $200 plus 9 percent of $5000, or a total of $650. You have been supplied with a list of items sold by each salesperson. The values of these items are as follows: Item Value A 239.99 B 129.75 C 99.95 D 350.89 Write a program that inputs one salesperson's items sold in a week (how many of item A? of item B? etc.) and calculates and displays that salesperson's earnings for that week.