View Single Post
  #3   Spotlight this post!  
Unread 02-02-2015, 16:20
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Declaring DoubleSolonoid

Quote:
Originally Posted by RobHammann View Post
...using something like

grabSolenoid.set(DoubleSolenoid::kForward);

it says "request for member 'set' in '(((Robot*)this))->Robot::grabSolenoid', which is of pointer type 'DoubleSolenoid' (maybe you meant to use '->' ?)"

where do I put the ->?
You have declared grabSolenoid as a pointer to a double solenoid object. The member functions like Set() only work on an actual object. You need to dereference the pointer before you can call the function. The '->' is a small bit of syntax convenience that lets you dereference the pointer and do the equivalent of a '.' at the same time.

Just replace the '.' with '->' between the variable name and the function name.
Reply With Quote