λ€νμ± - κ°μ λͺ¨μμ μ½λκ° λ€λ₯Έ λμμ νλ κ² - μ½λμ μμ μ€μ΄κ³ , μ¬λ¬ κ°μ²΄ νμ
μ νλμ νμ
μΌλ‘ κ΄λ¦¬κ° κ°λ₯νμ¬ μ μ§ λ³΄μμ μ’λ€. - λ©μλ μ€λ²λΌμ΄λ©λ λ€νμ±μ ν μ μμ 1) #λ€νμ± μμ 1 class Person: def __init__(self, name): self.name = name def work(self): print(self.name + " works hard") clas s Student(Person): def work(self): print(self.name + ' studies hard') class Engineer(Person): def work(self): print(self.name + "develope someting") student = Student("..
[Python] λ€νμ±, property
λ€νμ± - κ°μ λͺ¨μμ μ½λκ° λ€λ₯Έ λμμ νλ κ² - μ½λμ μμ μ€μ΄κ³ , μ¬λ¬ κ°μ²΄ νμ
μ νλμ νμ
μΌλ‘ κ΄λ¦¬κ° κ°λ₯νμ¬ μ μ§ λ³΄μμ μ’λ€. - λ©μλ μ€λ²λΌμ΄λ©λ λ€νμ±μ ν μ μμ 1) #λ€νμ± μμ 1 class Person: def __init__(self, name): self.name = name def work(self): print(self.name + " works hard") clas s Student(Person): def work(self): print(self.name + ' studies hard') class Engineer(Person): def work(self): print(self.name + "develope someting") student = Student("..
2020.11.24