Which of the Standard C++ casts can be used to perform a
?safe? downcast:
a) reinterpret_cast
b) dynamic_cast
c) static_cast
d) const_cast
Answers were Sorted based on User's Feedback
Answer / santosh mundhe
reinterpret_cast: Reinterpret_cast is only way to cast
between pointers and value type.
dynamic_cast:Dynamic_cast is used with pointers and
reference.It's purpose is - it provid valid object
conversion of requested class.
static_cast:Static_cast provides conversion from pointer to
related class not only from derived to base class.
const_cast:It manipulets constness of an object while
passing a const object to a function.
:-dynamic_cast performs a special checking during runtime.
| Is This Answer Correct ? | 3 Yes | 0 No |
Why are arrays usually processed with for loop?
Why is c++ still best?
Evaluate !(1&&1||1&&0) a) Error b) False c) True
What is #include sstream?
How the memory management in vectors are being done. What happens when the heap memory is full, and how do you handle it ?
How is static data member similar to a global variable?
Differentiate between declaration and definition.
What is the rule of three?
what is object?
What is conditions when using boolean operators?
What is Virtual Inheritance?
Which bit wise operator is suitable for putting on a particular bit in a number?