phthon 상속 (1) 썸네일형 리스트형 파이선 속성! 3 class Person: var sampleVar def __init__(self, name, age): self.name = name self.age = age def say_hello(self, to_name) print("hello! " +to_name + "I am" + self.name) def introduce(self): print("my name is" + self.name + "and I am " + str(self.age) + "years old") class Teacher(Person) def teach(self, to_teach): print("I am teaching" + to_teach) sam = Teacher("jenny", 28) sam.introduce() sam.teac.. 이전 1 다음