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
Write about an iterator class?
How can you quickly find the number of elements stored in a a) static array b) dynamic array ? Why is it difficult to store linked list in an array?how can you find the nodes with repetetive data in a linked list?
How many keywords are used in c++?
Would you rather wait for quicksort, linear search, or bubble sort on a 200000 element array? (Or go to lunch...) a) Quicksort b) Linear Search c) Bubble Sort
Describe protected access specifiers?
Define the process of error-handling in case of constructor failure?
Is eclipse good for c++?
Of the numbers 12 23 9 28 which would be at the top of a properly implemented maxheap a) 28 b) 9 c) Any of them could be
When do we use copy constructors?
What is an accessor in c++?
What is the oldest programming language?
Is there finally in c++?
What is the best way to take screenshots of a window with c++ in windows?
How static variables and local variablesare similar and dissimilar?
What is stack unwinding?