Programming/python

[python] 클래스 연습

그렉그의 2023. 3. 11. 23:26

python

1. class 

class Person:
def greeting(self):
print("hello")

클래스 사용 시,
james= Person()
class Person:
def greeting(self):
print("hello")


# 클래스 사용 시,
james = Person()

# 매서드 호출 시, 인스턴스를 통해 호출 함
james.greeting()