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?
3 Respostas
+ 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.
+ 1
I still don't understand when to use classes, could you please give an example ?
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