Answer Posted / mms zubeir
The above answers are correct. I would like to add some
details to those.
1. const_cast:- is used to cast away the constness of a
variable.
2. static_cast:- is used to cast between two types with the
available static information about the variable. It doesn't
know anything about the run time information. Additionally,
it knows the type and access previledges of the
variables/objects involved in the casting. For example, we
cannot cast a private base.
3. reinterpret_cast:- is used to cast between any pointer
types and the types need not be related. The developer
needs to take care of the correct types to be casted.
4. dynamic_cast:- is used to cast between polymorphic types
only. It allows downcasting and casting between siblings as
well. If the cast fails, it returns a 0/NULL instead of the
pointer to the resultant object incase of success.
| Is This Answer Correct ? | 6 Yes | 4 No |
Post New Answer View All Answers
Why is encapsulation used?
Why it is called runtime polymorphism?
What is the main purpose of inheritance law?
write a program to find 2^n+1 ?
What is encapsulation oop?
Why is object oriented programming so hard?
What does and I oop and sksksk mean?
Get me an image implementation program.
What is the full form of oops?
Why we use classes in oop?
Get me a number puzzle game-program
What do you mean by variable?
What are the features of oop?
program for insertion ,deletion,sorting in double link list
Why multiple inheritance is not allowed?