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 is the difference between strcpy() and strncpy()?

734


Which is best ide for c++?

654


Write a program to find the reverse Fibonacci series starting from N.

691


What are disadvantages of pointers?

662


What is the v-ptr?

744






What do you mean by vtable and vptr in c++?

721


What is the limitation of cin while taking input for character array?

1567


What is rtti in c++?

709


What is near, far and huge pointers? How many bytes are occupied by them?

770


A mXn matrix is given and rows and column are sorted as shown below.Write a function that search a desired entered no in the matrix .with minimum complexity 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

3335


Why namespace is used in c++?

699


What language does google use?

693


Why iomanip is used in c++?

738


Does c++ have finally?

651


What is extern c++?

610