0

The use of classes

So I recently started classes, and the way I interpret them is they are a way to create an object, and then we use methods to "describe" the object. Like in the exemple they created a dog and gave it some attributes and functions such as barking, how many legs it has, it's color, etc.. My question is, when do we axtually need to create a class? Any exemples were creating a class is must?

28th Jan 2017, 8:59 AM
ramzi
ramzi - avatar
3 Answers
+ 1
There is no such task, where we MUST create class to solve it. OOP is just another way to write code. Sometimes better to use classes, sometimes not. It depends on a situation. But many people think that we should use classes in every task, where we can. So, they think, code becomes more readable and more functional.
28th Jan 2017, 11:05 AM
Leshark
Leshark - avatar
+ 1
I still don't understand when to use classes, could you please give an example ?
13th Feb 2017, 4:57 PM
PrisseReine
0
Thanks alot Leshrak, I still think using classes is much harder then the usual way to write code though, but I'll still finish the course and see if I change my mind once I'm done
28th Jan 2017, 11:21 AM
ramzi
ramzi - avatar