self variable in python ?

Опубликовано: 03 Сентябрь 2024
на канале: Rahul Gaikwad
6
0

"""self Variable:"""

self is a reference variable that points to the
current object

it is used to refer instance
variables and methods.

"""
self should be first parameter inside constructor
and inside instance methods
"""

class Example:
def __init__(self):
pass

def instance_method_name(self):
pass

obj1 = Example()

obj1.instance_method_name()

When we create an object of a class, the
object name contains the memory location
of the object.

This memory location is internally passed to self, as
self knows the memory address of the object
so we can access variables and methods of the object.

#python #pythonprogramming
#coding #programming
#coder #oop #python3
#software
#pythonforbeginners
#pythonfordataanalysis
#developer
#development


На этой странице сайта вы можете посмотреть видео онлайн self variable in python ? длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Rahul Gaikwad 03 Сентябрь 2024, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 6 раз и оно понравилось 0 зрителям. Приятного просмотра!