“Selbst Schlüsselwort in Python” Code-Antworten

Klassen in Python mit Selbstparameter

self represents the instance of the class. By using the “self” keyword we can access the attributes and methods of the class in python. It binds the attributes with the given arguments. 
Dull Dogfish

Selbst Schlüsselwort in Python

class Person:
  def __init__(mysillyobject, name, age):
    mysillyobject.name = name
    mysillyobject.age = age

  def myfunc(abc):
    print("Hello my name is " + abc.name)

p1 = Person("John", 36)
p1.myfunc()

#self represents the instance of the class. By using the “self” keyword we can access the attributes and methods of the class in python. It binds the attributes with the given arguments. The reason you need to use self. is because Python does not use the @ syntax to refer to instance attributes
Sachin

Selbst Schlüsselwort in Python

self keyword
Said HR

Ähnliche Antworten wie “Selbst Schlüsselwort in Python”

Fragen ähnlich wie “Selbst Schlüsselwort in Python”

Weitere verwandte Antworten zu “Selbst Schlüsselwort in Python” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen