How many types of casting are there in C++?
When is a dynamic cast,static_cast,reinterpret cast used?

Answer Posted / berzerk

Casting Operators
There are several casting operators specific to the C++ language. These operators are intended to remove some of the ambiguity and danger inherent in old style C language casts. These operators are:

dynamic_cast Used for conversion of polymorphic types.

static_cast Used for conversion of nonpolymorphic types.

const_cast Used to remove the const, volatile, and __unaligned attributes.

reinterpret_cast Used for simple reinterpretation of bits.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What number of digits that can be accuratly stored in a float (based on the IEEE Standard 754)? a) 6 b) 38 c) An unlimited number

1006


Explain the use of vtable.

831


What is polymorphism & list its types in c++?

804


Which operator cannot overload?

804


What is a syntax in c++?

864


Describe the advantage of an external iterator.

796


Where Malloc(), Calloc(), and realloc() does get memory?

812


What are the uses of typedef in a program?

814


What are pointer-to-members? Explain.

806


Write some differences between an external iterator and an internal iterator? Describe the advantage of an external iterator.

816


Why is c++ difficult?

791


What is buffer and example?

706


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

1220


How can you differentiate between inheritance and implementation in c++?

893


What is a vector c++?

823