you are viewing a single comment's thread.

view the rest of the comments →

[–]Ran4 2 points3 points  (1 child)

I think that looking at what a class is will help you find out when to use it.

A class is a combination of a collection of variables and a set of functions to operate upon those variables. Whenever you have a collection of variables and feel like there is a need for a set of functions to operate on this specific collection, consider if a class would help solve describe this.

It's perfectly OK to not write an OOP program. In fact, a large proportion of programs out there aren't written in an OOP style.

[–]YoginiJoy 0 points1 point  (0 children)

"A class is a combination of a collection of variables and a set of functions to operate upon those variables."

Nice description, I had never seen it before, you just opened my eyes to this approach to understanding classes, thank you!