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 this pointer in c++?
What happens when you make call 'delete this;'?
Write some differences between an external iterator and an internal iterator?
Why do we learn c++?
What are friend functions in C++?
Can you use the function fprintf() to display the output on the screen?
What is the difference between #import and #include in c++?
What is the use of object in c++?
What ANSI C++ function clears the screen a) clrscr() b) clear() c) Its not defined by the ANSI C++ standard
Mention the ways in which parameterized can be invoked. Give an example of each.
What do you mean by storage classes?
We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p?
Explain pass by value and pass by reference.
What is virtual destructor ans explain its use?
Is java the same as c++?