Is there an actual difference between a const_cast and c style cast (ObjectType) ?
Is there an actual difference between a const_cast and c style cast (ObjectType) ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A
const_castconveys specific information about the intent behind the cast that a C cast cannot.If you accidentally try to use a
const_castfor purposes other than adding or removingconstorvolatile, the compiler will help you with an error message.Also,
const_castis searchable, unlike a C-style cast.