Instance Methods
Introduction to OOP's
Class
Object
Constructor
Instance Variables
Class Variables
Instance Methods
self Keyword
Encapsulation
Public Members
Protected Members
Private Members
Inheritance
Single Inheritance
Multiple Inheritance
Multilevel Inheritance
Hierarchical Inheritance
Hybrid Inheritance
super() Function
Polymorphism
Method Overriding
Duck Typing
Abstraction
Abstract Class
Abstract Method
Class Method
Static Method
Special Methods
_str_ Method
Operator Overloading
Composition
Aggregation
Association
Method Resolution Order
Object Class
issubclass() and isinstance()
Property Decorator
Setter Method with @property
Destructor
Inner Class
Complete Mini Example
Instance Methods
6. Instance Methods
Instance methods operate on object data and receive self as the first parameter. They are the most common methods used in Python classes.
Syntax
class ClassName:
def method_name(self):
pass
Example
class Person:
def __init__(self, name):
self.name = name
def greet(self):
print("Hello", self.name)
p = Person("Ramesh")
p.greet()
Output
Hello Ramesh
Example
Executing...
❌ Error:
✅ Output:
// Click Run ▶ to execute
🏋️ Test Yourself With Exercises
Take our quiz on Instance Methods to test your knowledge.
Browse Quizzes »