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 prototype of printf function?

0 Answers  


Why is the function main() special?

0 Answers  


What are the different types of Storage classes?

5 Answers  


What is an ABC: an "Abstract Base Class"?

1 Answers  


How would you stop a class from class from being derived or inherited?The constructer should not be Private,as object instantiation should be allowed.

15 Answers   Satyam,






What is static function and static class?

4 Answers   HCL,


What is a flag in c++?

0 Answers  


Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)

0 Answers  


What do you mean by volatile and mutable keywords used in c++?

0 Answers  


Are vectors faster than arrays?

0 Answers  


Can you be bale to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?

0 Answers  


What does the ios::ate argument do?

0 Answers  


Categories