View Single Post
  #6   Spotlight this post!  
Unread 29-10-2008, 21:53
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,513
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Team 67 C++ Example Code

You explanation is clear (I've spent the last couple days reading about classes, objects, structures, constructors, and pointers).

When I learned programming - and perhaps I'm dating myself here - I was always taught you write a function to return a single value. Send the values you need into the procedure, and it returns a result.

In a case where you MUST have a procedure return multiple results (and I was always taught that this was sloppy programming) you could always pass by reference, or use an (evil evil) global variable.

See Kevin Watson's C-code for an example of how I was taught to code using functions.

I'm sure I'm missing something since the whole class / pointer system is new to me. But I'm struggling to see a reason to program using them as opposed to using functions and returning values. This is probably just because I haven't gotten into the level of complexity where they become useful.
Reply With Quote