"""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
In questa pagina del sito puoi guardare il video online self variable in python ? della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Rahul Gaikwad 03 settembre 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 6 volte e gli è piaciuto 0 spettatori. Buona visione!