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



Which of the Standard C++ casts can be used to perform a ?safe? downcast: a) reinterpret_cast b) ..

Answer / guest

dynamic_cast

Is This Answer Correct ?    5 Yes 0 No

Which of the Standard C++ casts can be used to perform a ?safe? downcast: a) reinterpret_cast b) ..

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

Post New Answer

More C++ General Interview Questions

What is the best c++ compiler?

0 Answers  


What is the difference between structures and unions?

0 Answers  


Keyword mean in declaration?

0 Answers  


Explain stack & heap objects?

0 Answers  


What will happen if I allocate memory using "new" and free it using "free" or allocate sing "calloc" and free it using "delete"?

3 Answers  






What can I use instead of namespace std?

0 Answers  


Explain explicit container.

0 Answers  


Explain linked list using c++ with an example?

0 Answers  


What is c++ hash?

0 Answers  


Can we define function inside main in c++?

0 Answers  


How to create a pure virtual function?

1 Answers  


Explain public, protected, private in c++?

0 Answers  


Categories