Learning Circle : python #12 - ex44.py

master
youngjin.han 2020-06-17 22:25:02 +09:00
parent 54ba60818b
commit a753cfeaac
7 changed files with 121 additions and 0 deletions

View File

@ -1,3 +1,11 @@
* 2020-06-17
*** Python #11:
**** DONE Lecture content
CLOSED: [2020-06-17 수 22:24]
- Same structure as "Python #2"
- Exercise 44
**** Lecture material
- Available on https://cloud.ungleich.ch/s/435FyfrQyEq6oF3
* 2020-06-15
*** DONE Python #10:
CLOSED: [2020-06-15 월 23:55]

View File

@ -0,0 +1,13 @@
class Parent(object):
def implicit(self):
print("PARENT implicit()")
class Child(Parent):
pass
dad = Parent()
son = Child()
dad.implicit()
son.implicit()

View File

@ -0,0 +1,15 @@
class Parent(object):
def override(self):
print("PARENT override()")
class Child(Parent):
def override(self):
print("CHILD override()")
dad = Parent()
son = Child()
dad.override()
son.override()

View File

@ -0,0 +1,17 @@
class Parent(object):
def altered(self):
print("PARENT altered()")
class Child(Parent):
def altered(self):
print("CHILD, BEFORE PARENT altered()")
super(Child, self).altered()
print("CHILD, AFTER PARENT altered()")
dad = Parent()
son = Child()
dad.altered()
son.altered()

View File

@ -0,0 +1,32 @@
class Parent(object):
def override(self):
print("PARENT override()")
def implicit(self):
print("PARENT implicit()")
def altered(self):
print("PARENT altered()")
class Child(Parent):
def override(self):
print("CHILD override()")
def altered(self):
print("CHILD, BEFORE PARENT altered()")
super(Child, self).altered()
print("CHILD, AFTER PARENT altered()")
dad = Parent()
son = Child()
dad.implicit()
son.implicit()
dad.override()
son.override()
dad.altered()
son.altered()

View File

@ -0,0 +1,32 @@
class Other(object):
def override(self):
print("OTHER override()")
def implicit(self):
print("OTHER implicit()")
def altered(self):
print("OTHER altered()")
class Child(object):
def __init__(self):
self.other = Other()
def implicit(self):
self.other.implicit()
def override(self):
print("CHILD override()")
def altered(self):
print("CHILD, BEFORE OTHER altered()")
self.other.altered()
print("CHILD, AFTER OTHER altered()")
son = Child()
son.implicit()
son.override()
son.altered()

View File

@ -1,3 +1,7 @@
* 2020-06-17
** note
- ex44.py
- none
* 2020-06-15
** note
- ex43.py