How to cast a pointer to void object to class object?
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.
With a
static_cast. Note that you must only do this if the pointer really does point to an object of the specified type; that is, the value of the pointer tovoidwas taken from a pointer to such an object.If you find yourself needing to do this, you may want to rethink your design. You’re giving up type safety, making it easy to write invalid code: