🤍 전 강의 25% 할인 중 🤍
2024년 상반기를 돌아보고 하반기에도 함께 성장해요!인프런이 준비한 25% 할인 받으러 가기 >>
132만명의 커뮤니티!! 함께 토론해봐요.
그 클래스 메소드와 스태틱메소드의 실사용례는 이러할까요? 약간 스태틱메소드는 상속받아도 변하지 않는 것과 관련된 메소드에 사용하고 클래스메소드는 상속받으면 변할 수 있는것과 관련되 메소드에 사용하는? 이에 대한 이해는 이부분 을 참고했습니다. # Online Python compiler (interpreter) to run Python online. # Write Python 3 code in this online editor and run it. class wooden_furniture: ingredient = "wooden" furniture = "furniture" @staticmethod def get_ingredient(): print("made_by_wooden") return "made_by_wooden" @classmethod def get_furniture(cls): print( f"{cls.furniture}") return "class" class wooden_table(wooden_furniture): def __init__(self): self.furniture = "table" table = wooden_table() furniture = wooden_furniture() table.get_ingredient() table.get_furniture() furniture.get_ingredient() furniture.get_furniture()