첨부 소스 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170
class Person:
    "부모 클래스"

    def __init__(self, name, phoneNumber):
        self.Name        = name
        self.PhoneNumber = phoneNumber

    def PrintData(self):
        print("Person(Name:{0}, Phone Number: {1})".format(self.Name, self.PhoneNumber))

class Student(Person):
    "자식 클래스"

    def __init__(self, name, phoneNumber, subject, studentID):
        self.Name        = name
        self.PhoneNumber = phoneNumber
        self.Subject     = subject
        self.StudentID   = studentID

print(issubclass(Person , object )) # True
print(issubclass(Person , Student)) # False
print(issubclass(Student, object )) # True
print(issubclass(Student, Person )) # True
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요