티스토리 뷰

 

 

def Test12_1():
    import ClassB
    from ClassB import cClassB

    obj1 = cClassB()
    obj1.AddValues(3)
    print(obj1.Value1)

def Test12_2():
    import ClassB
    from ClassB import cClassB

    obj1 = cClassB()
    obj1.AddValues(4)
    print(obj1.Value1)

if __name__=="__main__":

    from ClassB import cClassB
    Test12_1() # ==> 13
    cClassB.Value1 = 30
    Test12_2() # ==> 34
Value10 = 100

class cClassB:
    Value1 = 10

    def __init__(self):
        self.Value2 = 20

    def AddValues(self, valueIn):
        self.Value1 += valueIn
        self.Value2 += valueIn

    def AddValue2(self, valueIn):
        self.Value2 += valueIn

def AddValue10(valueIn):
    Value10 += 100

def SetClassValue(valueIn):
    cClassB.Value1 = valueIn
반응형
반응형
250x250
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함