본문 바로가기

Python Object-oriented Programming49

super() Method Introduction to the Python super super() 명령어는 상속 관계에서 대상의 부모 클래스를 반환하는 함수 구문 super(대상클래스_이름, 대상클래스_object) # Class 선언 내부에서 super를 호출하면, 인자 전달을 따로 하지 않아도 자동으로 해당 클래스의 부모 클래스를 호출해줍니다. 참조 Code class Employee: def __init__(self, name, base_pay, bonus): self.name = name self.base_pay = base_pay self.bonus = bonus def get_pay(self): return self.base_pay + self.bonusCode class SalesEmployee(Employee): .. 2023. 3. 31.
Static Methods https://www.pythontutorial.net/python-oop/python-static-methods/ Python Static Methods Explained Clearly By Practical Examples In this tutorial, you'll learn about Python static methods and how to use define utility methods for a class. www.pythontutorial.net Introduction to Python static methods instance method는 바인딩된 개체의 상태에 액세스하고 수정할 수 있다. class method는 클래스 상태에 액세스하고 수정할 수 있습니다. static method는.. 2023. 3. 31.
__new__() Method https://www.pythontutorial.net/python-oop/python-__new__/ Python __new__ In this tutorial, you'll learn about the Python __new__ method and understand how Python uses it to create a new object. www.pythontutorial.net 파이썬 __new__ 메서드 소개 1. 클래스의 인스턴스를 만들 때 Python은 먼저 __new__() method를 호출하여 객체를 생성한 다음 __init__() method를 호출하여 객체의 속성을 초기화합니다. 2. __new__()는 object Class 의 static method입니다. 3. [수동 객체 생.. 2023. 3. 31.
[ OOP ] Index CLASSES & OBJECTS Python Object-oriented Programming - callable Class Class Variables 함수& Methods __init__: Initializing Instance Attributes Instance Variables Private Attributes Class Attributes Static Methods - class methods SPECIAL METHODS __str__ __repr__ __eq__ __hash__ __bool__ __del__ PROPERTY Property @property Decorator Readonly Property Delete Property SINGLE INHERITANCE Inheritance Ov.. 2023. 3. 31.