부스트캠프 AI Tech 3기 Pre-Course [2]-2 객체 지향 언어의 특징 상속 : Inheritance 부모클래스로부터 속성과 method를 자식클래스가 물려받게 만드는 것 class Person(object): def __init__(self, name,age): self.name=name self.age=age def about_me(self): print("이름은 {}, 나이는 {}입니다.".format(self.name,self.age)) #person이라는 부모클래스를 korean이라는 클래스에 상속 class Korean(Person): pass k1=Korean("yo", 33) print(k1) >>이름은 yo, 나이는 33입니다. super() : 자기 자신의 부모 클래스를 사용 부모 클래스가 가진 속성을 불러낼 수 있다. class Employee(Perso.. 이전 1 다음