self variable in python ?

Publicado em: 03 Setembro 2024
no canal de: 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


Nesta página do site você pode assistir ao vídeo on-line self variable in python ? duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Rahul Gaikwad 03 Setembro 2024, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 6 vezes e gostou 0 espectadores. Boa visualização!