-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex45.py
More file actions
51 lines (33 loc) · 743 Bytes
/
ex45.py
File metadata and controls
51 lines (33 loc) · 743 Bytes
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#Animal is-a object
class Animal(object):
pass
class Dog(Animal):
def __init__(self,name):
self.name = name
class Cat(Animal):
"""docstring for Cat"""
def __init__(self, name):
self.name = name
class Person(object):
def __init__(self, name):
self.name = name
self.pet = None
class Employee(Person):
def __init__(self, name,salary):
super(Employee,self).__init__(name)
self.salary = salary
class Fish(object):
pass
class Salmon(Fish):
pass
class Halibut(Fish):
pass
rover = Dog("Rover")
satan = Cat("Satan")
mary = Person("Mary")
mary.pet = satan
frank = Employee("Frank",120000)
frank.pet = rover
flipper = Fish()
crouse = Salmon()
harry = Halibut()