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 |
Consider the following code fragment: int main(void) { int m = 4; mystery ( m ); mystery ( m ); printf("%d", m); return 0; } What is the output on the monitor if mystery is defined as follows ? void mystery (int m) { m = m+3; }
What is object file? How can you access object file?
What is stoi in c++?
What is an orthogonal base class in c++?
What does asterisk mean in c++?
Should the member functions which are made public in the base class be hidden?
Does a derived class inherit or doesn't inherit?
What is oops in c++?
What are the types of STL containers?
What is the cout in c++?
founder of c++
7 Answers Microtek, TCS, TeleCommand,
What is istream c++?