First off, yes! Sorry, my example was very bad! lol. I had to go out and didn't have much time to write it out.
As for clearBuffer() not meant to be there, I just threw it in there instead of formatting another .cpp file. My bad!
Again, it was bad. I used the class methods to convey that the class should in fact take care of the data, rather than getters/setters.
From the little information I found on creating a 'good' class, I have this idea in my head that the class should be the primary source of control, over it's variables. i.e., as little interaction via getters/setters. Would I be correct in thinking this?
I made a tic-tac-toe game the other day, using classes. If anyone cares to take a look and give some insight as to whether I am using classes in a good manner, I'd appreciate it!
Thanks. I shall look them up in a minute!.
I do tend to do what your example suggests, whereas I wouldn't need to set the speed etc. But then I find myself going "back to my roots" - so to speak. And then using settters for post creation.
I'm primarily in the console at the moment. Deciding whether to go down the road of Win32 or SDL. As mentioned above in my post, it was a bad example, and as being in the console, that's the first thing that popped in my head, to add in to the class' method, lol.
|and they do provide encapsulation where direct access would be used instead.|
For some reason, my tutor/lecturer at university always made us declare the variables as private and use setters/getters.
He was by no means a half decent teacher. But alas, I did learn a few things from him. albeit where to look on Google! aha!
And thanks a lot for the reply's!