Implementing Methods in a Class

Get to know about the role of methods in classes and what method overloading is.

In this lesson, we will learn about the interaction between properties and other objects. This is where methods come into play. There are three types of methods in Python:

  1. instance methods

  2. class methods

  3. static methods

We will be discussing instance methods in this lesson since they are used the most in Python OOP.

Note: We will be using the term methods for instance methods since they are most commonly used. Class methods and static methods will be named explicitly as they are.

The purpose of methods

Methods act as an interface between a program and the properties of a class in the program.

These methods can either alter the content of the properties or use their values to perform a particular computation.

Definition and declaration

A method is a group of statements that performs some operations and may or may not return a result.

We will extend the Employee class example by adding methods to it.

Get hands-on with 1200+ tech skills courses.