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

Is it possible to provide default values while overloading a binary operator?

0 Answers  


What is class invariant in c++?

0 Answers  


Why is null pointer used?

0 Answers  


What does scope resolution operator do?

0 Answers  


Why main function is special in c++?

0 Answers  






Explain one method to process an entire string as one unit?

0 Answers  


What are Binay tress and B trees? Diff between them?

8 Answers   CTS, GATE, Wipro,


What C++ libraries are you proficient with?

1 Answers   Google,


Show the application of a dynamic array with the help of an example.

0 Answers  


How do you remove an element from a set in c++?

0 Answers  


What happens when you make call 'delete this;'?

0 Answers  


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.

4 Answers   Quark,


Categories