pythod OOP methods [duplicate]

  oop, python, python-3.x

I have been learning python and currently learning OOP python and saw this on W3 schools but dont understand how it works

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()

Doesn’t the method have to reference current instance of the class to access variables of class so confused as to why the method can use abc and not my sillyobject and be able to compile. Any explanation would be so helpful. Sorry if this is really obvious am newish to python

Source: Python Questions

LEAVE A COMMENT