Class inheritance

class Animal():
  
  def __init__(self, age, color):
    self.age = age
    self.color = color
    
  def crossbreed(self, other):
    return Animal(0, self.color+' and '+other.color)
  
  def make_sound(self):
    print("Animal speaks!")
class Dog(Animal):  # Dog is a subclass of Animal
  
  def __init__(self, breed, age, color):   # reimplementing the constructor method
    self.breed = breed
    self.age = age
    self.color = color
    
  def make_sound(self):   # reimplementing the make_sound method
    print("Woof woof!")
    
    
class Cat(Animal):
  
  def make_sound(self):
    print("Meow!")
    
    
# main chunk
fido = Dog('boxer', 2, 'brown')
whiskers = Cat(2, 'black')
turtle = Animal(1, 'white')
fido.make_sound()
whiskers.make_sound()
turtle.make_sound()
Woof woof!
Meow!
Animal speaks!