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 |
Is it possible to provide default values while overloading a binary operator?
What is class invariant in c++?
Why is null pointer used?
What does scope resolution operator do?
Why main function is special in c++?
Explain one method to process an entire string as one unit?
What are Binay tress and B trees? Diff between them?
What C++ libraries are you proficient with?
Show the application of a dynamic array with the help of an example.
How do you remove an element from a set in c++?
What happens when you make call 'delete this;'?
Which one of the following describes characteristics of "protected" inheritance? a) The base class has access only to the public or protected members of the derived class. b) The derived class has non-public, inheritable, access to all but the private members of the base class. c) The derived class has access to all members of the base class. d) The private members of the base class are visible within the derived class. e) Public members of the derived class are privately accessible from the base class.