Sahithyan's S1 — Programming Fundamentals
Object-Oriented Programming
Object-Oriented Programming (OOP) is a programming paradigm based on the concept of “objects”, which can contain data and code. Here is a basic example:
self
Keyword
In Python, the self
keyword is used in object-oriented programming to
represent the instance of the class. It allows you to access the attributes and
methods of the class in Python. When you create an instance of a class, self
refers to that specific instance.
Here’s a simple example to illustrate:
In this example, self.name
refers to the name
attribute of the dog1
instance.