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 |
What return value must conversion operators have in their declaration?
What parameter does the constructor to an ofstream object take?
If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?
What will strcmp("Astring", "Astring"); return a) A positive value b) A negative value c) Zero
What is implicit pointer in c++?
Explain the differences between list x; & list x();.
What is the real purpose of class – to export data?
Explain what are single and multiple inheritances in c++?
Difference between shift left and shift right?
What is oops in c++?
Are c and c++ similar?
What are maps in c++?