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 meant by forward referencing and when should it be used?

546


Explain "const" reference arguments in function?

604


Of the numbers 12 23 9 28 which would be at the top of a properly implemented maxheap a) 28 b) 9 c) Any of them could be

923


If a function doesn’t return a value, how do you declare the function?

610


What is a down cast?

601






Explain how to initialize a const member data.

592


What is rvalue?

673


Why was c++ made?

648


Explain dangling pointer.

674


Write a program using GUI concept for the scheduling algorithms in Operating system like SJF,FCFS etc..

3354


Which software is used to run c++ program?

546


What is c++ stringstream?

598


What is vector processing?

660


What are the advantages of early binding?

604


Why is c++ considered difficult?

639