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 :: operator in c++?
What is ios in c++?
What are the benefits of c++?
Which sort does c++ use?
Is main a class in c++?
what is upcasting in C++?
What is virtual base class?
What data encapsulation is in c++?
What is a container class?
What is the prototype of printf function?
What is the c++ code?
Differentiate between realloc() and free().
How can we access protected and private members of a class?
an integer constant must have atleast one a) character b) digit c) decimal point
What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?