View Single Post
  #7   Spotlight this post!  
Unread 01-14-2009, 05:15 PM
heydowns's Avatar
heydowns heydowns is offline
Registered User
AKA: Jeff Downs
FRC #1511 (Rolling Thunder)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Ra-Cha-Cha
Posts: 142
heydowns has a reputation beyond reputeheydowns has a reputation beyond reputeheydowns has a reputation beyond reputeheydowns has a reputation beyond reputeheydowns has a reputation beyond reputeheydowns has a reputation beyond reputeheydowns has a reputation beyond reputeheydowns has a reputation beyond reputeheydowns has a reputation beyond reputeheydowns has a reputation beyond reputeheydowns has a reputation beyond repute
Re: void* pointer to object in C++

Quote:
Originally Posted by byteit101 View Post
like (Gyro)MyPointer->GetValue();?
or ((Gyro)MyPointer)->GetValue();?
or ((Gyro)(*MyPointer))->GetValue();?
None of the above.
Your pointer is the wrong type. So it's the pointer you have to cast to the correct type of pointer:

((Gyro *)MyPointer)->GetValue()

But you don't want to do this Do as suggested in the prior posts as it is much cleaner and less error-prone.
Reply With Quote