0
What is The Importance of Using Classes ????.....It 's Sounds Kinda Like Methods
3 odpowiedzi
+ 2
I'll try to keep it simple, but classes play a huge role in object oriented programming. First, duplication. With classes, you can have multiple objects without having to type out the specifics of each one. One class, multiple objects can be created from it. Encapsulation. Hiding data from users. With classes, you can have private variables and public methods so you can control what the user can do/see with the variables. Polymorphism. Allowing one class to use aspects of another to fill its role.
Could make this a lot longer, since it's a lot to talk about. But hope you get the idea. Classes are not like methods.
0
ThanX James xD
0
Class is like a template, which can be used for an object (e.g. savings account, car) these are objects.
For a savings account, you can create a class. A savings account have the attributes namely account#, pin, balance. And on these attributes, we can perform some operations which are eventually achieved by methods