[Python #9] update e42.py

This commit is contained in:
kjg 2020-06-12 23:10:56 +09:00
parent 9e67105185
commit bad94148be

View file

@ -1,6 +1,7 @@
## Animal is-a object (yes, sort of confusing) look at the extra credit ## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object): class Animal(object):
pass def something(self):
print("base")
## Dog is-a Animal ## Dog is-a Animal
@ -37,7 +38,8 @@ class Employee(Person):
## Fish is-a object ## Fish is-a object
class Fish(object): class Fish(object):
pass def __init__(self):
print("Base Fish")
## Salmon is-a Fish ## Salmon is-a Fish
@ -52,7 +54,7 @@ class Halibut(Fish):
## rover is-a Dog ## rover is-a Dog
rover = Dog("Rover") rover = Dog("Rover")
rover.something()
## satan is-a Cat ## satan is-a Cat
satan = Cat("Satan") satan = Cat("Satan")