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
Write a note about the virtual member function?
Is c++ a dying language?
What does the following do: for(;;) ; a) Illegal b) Loops forever c) Ignored by compiler...not illegal
What do you mean by overhead in c++?
How do you add an element to a set in c++?
Explain queue. How it can be implemented?
What information can an exception contain?
What are virtual constructors/destructors?
What is late binding c++?
Is c# written in c++?
What is difference between class and function?
Function can be overloaded based on the parameter which is a value or a reference. Explain if the statement is true.
What is singleton pattern in c++?
Why is c++ so fast?
Assume an array of structure is in order by studentID field of the record, where student IDs go from 101 to 500. Write the most efficient pseudocode algorithm you can to find the record with a specific studentID if every single student ID from 101 to 500 is used and the array has 400 elements. Write the most efficient pseudocode algorithm you can to find a record with a studentID near the end of the IDs, say in the range from 450 to 500, if not every single student ID in the range of 101 to 500 is used and the array size is only 300