In class-based programming, methods are defined within a class , and objects are instances of a given class. One of the most important capabilities that a method provides is method overriding – the same name (e.g., area ) can be used for multiple different kinds of classes.
Read moreWhy use a class instead of a method?
By using classes, you’re ensuring that methods are only used on one set of data . This adds to the security of the code because you’re less likely to use functions where they don’t belong.
Read more