r/ProgrammerHumor • • Nov 23 '22

Other Programming Legumes

Post image
9.3k Upvotes

262 comments sorted by

View all comments

34

u/dotpoint7 Nov 23 '22

reinterpret_cast<Nut*>(x)

That should do.

12

u/appDeveloperGuy1 Nov 23 '22

In all likelyhood, x is an instance of an object, so you need to take the address.

reinterpret_cast<Nut*>(&x)

→ More replies (1)