https://dojang.io/mod/page/view.php?id=2388 https://www.delftstack.com/ko/howto/python/nested-class-in-python/
# 다이아몬드 상속
class die_a_mond:
def test(self):
print('다이아몬드 테스트 중')
class Person(die_a_mond):
def greeting(self):
print('안녕하세요.')
class University(die_a_mond):
def manage_credit(self):
print('학점 관리')
class Undergraduate(Person, University):
def study(self):
print('공부하기')
# 공부하기: 파생 클래스 Undergraduate에 추가한 study 메서드
https://www.delftstack.com/ko/howto/python/nested-class-in-python/
class Dept:
def __init__(self, dname):
self.dname = dname
class Prof:
def __init__(self,pname):
self.pname = pname
math = Dept("Mathematics")
mathprof = Dept.Prof("Mark")
test = Dept('test_init')
test2 = Dept.Prof('test_init')
print(test.dname)
print(test2.pname)
>>> print
test_init
test_init