I am new to OOP and cant find a good tutorial for Classes.. I get the basic concept but every time I find a tutorial with an example the example is useless.
Now I know most of the time they are just trying to keep is simple but I need a working example or two to wrap my brain around it.
Anyway I am just a little frustrated as I have hit a bit of a wall.
Yeah it can be difficult to find a good example for classes without it getting crazy complicated. I was digging through my own code to look for a class that would be a good and simple example, but everything I found was pretty complex.
=( sorry. Maybe someone else has a practical example that's also simple. I'm stumped. lol
It is not that the examples are too complicated it is that in a way they are too simple. There is no reason for why they are doing what they are doing.
The tutorial does not give a practical example. It would be great if they would give you a problem and a way for a class to solve it.
And maybe an example of why it is better to use OOP over just banging out a simple function or two would be good too.
Well functions perform a task, whereas classes represent a "thing".
Good pracical examples are the STL. Specifically std::string.
Just make a string with string mystring; and now mystring IS a string.
Really, all std::string is just a collection of functions like any other class, but in concept, it's more than that. It's a type. It's a thing. You can create strings, work with them as if they were strings, etc.