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
What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }
Is this job good for future? can do this job post grduate student?
How to improve object oriented design skills?
Give an example where we have to specifically use C programming language and C++ programming language cannot be used?
How do you define social class?
What is inheritance write a program to show use of inheritance?
Can bst contain duplicates?
What is protected in oop?
what is difference between class template and template class?
What is solid in oops?
What is the benefit of oop?
write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.
What are oops methods?
What are the important components of cohesion?
Can we create object of abstract class?