IT
반응형
분류 전체보기
(45)
JAVA
(6)
Pyhton
(21)
JAVA Script
(10)
Jquery
(5)
etc
(1)
NodeJs
(2)
클라우드
(0)
홈
태그
미디어로그
위치로그
방명록
/
/
블로그 내 검색
클래스
2017. 8. 4. 00:38
반응형
파이썬의 클래스 기본구조
class 클래스명(상속클래스명):
클래스 변수들
.
.
.
def __init__(self): #초기 호출함수
def 함수명(변수들...):
.
.
.
class catchTheSky: str = "" def __init__(self, word): self.str = word def fnPrint(self, word2): print(self.str, word2) cat = catchTheSky("클래스") cat.fnPrint("테스트") #클래스 테스트 출력 class superClass(catchTheSky): # 괄호안에 상속받을 클래스를 지정한다. def fnPrint(self, word2): #fnPrint함수 override print(word2, self.str) sky = superClass("상속") sky.fnPrint("테스트") # 테스트 상속 출력
반응형
공유하기
게시글 관리
IT
저작자표시
비영리
변경금지
'
Pyhton
' 카테고리의 다른 글
예외처리
(0)
2017.08.05
모듈과 패키지
(0)
2017.08.04
함수(2)
(0)
2017.08.03
파이썬 파일
(0)
2017.08.01
함수(1)
(0)
2017.07.30
+ Recent posts
Powered by
Tistory
, Designed by
wallel
Rss Feed
and
Twitter
,
Facebook
,
Youtube
,
Google+
티스토리툴바