행위

파이썬 클래스

DB CAFE

Dbcafe (토론 | 기여)님의 2019년 4월 25일 (목) 12:45 판 (새 문서: = 파이썬 클래스 = == 예제 == <source lang=python> class ClassCalc: def __init__(self, first, second): self.first = first self.second = second def setd...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)
thumb_up 추천메뉴 바로가기


1 파이썬 클래스[편집]

1.1 예제[편집]

class ClassCalc:
    def __init__(self, first, second):
        self.first = first
        self.second = second
    def setdata(self, first, second):
        self.first = first
        self.second = second
    def add(self):
        result = self.first + self.second
        return result
    def mul(self):
        result = self.first * self.second
        return result
    def sub(self):
        result = self.first - self.second
        return result
    def div(self):
        result = self.first / self.second
        return result