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 is the function main() special?
Explain virtual class?
How the V-Table mechanism works?
Can you explicitly call a destructor on a local variable?
Why is that unsafe to deal locate the memory using free( ) if it has been allocated using new?
What are the different types of polymorphism in c++?
What is implicit pointer in c++?
What is &x in c++?
What is the use of volatile keyword in c++? Give an example.
What is c++ and its features?
What is the use of c++ programming language in real life?
What is the use of string in c++?