python oop2 Python OOP 메모장 만들기 Python OOP 메모장 만들기## teamlab_note.pyclass Note(object): """docstring for Note.""" def __init__(self, content = None): super(Note, self).__init__() self.content = content def write_content(self, content): self.content = content def remove_all(self): self.content = "" def __str__(self): return str(self.write_content) class NoteBook(object): """docstring for NoteBook.""" def __init__(self, title): .. 2018. 9. 26. Python Objects in Python(파이썬에서의 객체) Python Objects in Python(파이썬에서의 객체) class SoccerPlayer(object): """docstring for SoccerPlayer.""" def __init__(self, name, position, back_number): ## __init__ 객체 생성 예약어 사용 필수 ## self 현재 범위안의 객체 자신을 가리킴 사용 필수 super(SoccerPlayer, self).__init__() self.name = name self.position = position self.back_number = back_number def change_back_number(self, new_number): print("선수의 등번호룰 변경합니다 : From %d to %d".. 2018. 9. 26. 이전 1 다음