I don’t know if it is right in this exercise,could anybody can help me to see.`##Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
Dog is-a Animal with it’s self and name in init function
class Dog(Animal):
def init(self, name):
## dog has-a name is name
self.name = name
Cat is-a Animal with it’s self and name in init function
class Cat(Animal):
def __init__(self, name):
## cat has-a name is name
self.name = name
Person is-a object with his self and name in init function
class Person(object):
def __init__(self, name):
## Person has-a name is name
self.name = name
##Person has-a pet of some kind
self.pet = None
emplouee is-a person with self name and salary params in init function
class Emplouee(Person):
def init(self, name, salary):
## super function has-a __init__function with name,and super function with Emplouee and self
super(Employee, self).init(name)
## emplouee has-a salary name salary
self.salary = salary
fish is-a obj
class Fish(object):
pass
salmon is-a fish
class Salmon(Fish):
pass
halibut is-a fish
class Halibut(Fish):
pass
rover is-a Dog
rover = Dog(“Rover”)
satan is a Cat
satan = Cat(“Satan”)
mary is-a Person
mary = Person(“Mary”)
mary has-a pet named satan
mary.pet = satan
frank is-a employee and has 1200000
frank = Employee(“Frank”,1200000)
frank has-a cat named rover
frank.pet = rover
flipper is-a Fish
flipper = Fish()
course is-a salmon
course = Salmon()
harry is-a halibut
harry = Halibut()`