|
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.
|