class1 [Python] Classes 파이썬에 대한 기본적인 이해를 위해 작성했습니다 __init__ class Rectangle: def __init__(self, width, height): self.width = width self.height = height __init__ 메서드에 두 번째 및 세 번째 인수로 전달되는 인수를 사용하여 Rectangle 클래스를 호출하여 인스턴스를 만든다. 첫 번째 인수(self)는 Python에 의해 자동으로 채워지며 생성되는 객체 그 자체를 의미한다. self를 사용하는 것은 단지 관례일 뿐, 어떤 이름을 지어도 상관없다. Instance method class Rectangle: def __init__(self, width, height): self.width = width self.height.. 2023. 4. 2. 이전 1 다음