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
Answer Posted / 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 |
Post New Answer View All Answers
What is the use of setprecision in c++?
What is stl containers in c++?
Is turbo c++ free?
What is iostream in c++ used for?
Explain the problem with overriding functions
Define the process of handling in case of destructor failure?
What is a namespace in c++?
What is c++ namespace?
Which one is better- macro or function?
How can we read/write Structures from/to data files?
How the endl and setw manipulator works?
What is a loop? What are different types of loops in c++?
what is oops and list its features in c++?
How does a C++ structure differ from a C++ class?
How to tokenize a string in c++?