Python - Inheritance and Code Reuse
What will be the output of the following code?
class Animal:
def sound(self):
print("Some sound")
class Dog(Animal):
def sound(self):
print("Bark")
pet = Dog()
pet.sound()What will be the output of the following code?
class Animal:
def sound(self):
print("Some sound")
class Dog(Animal):
def sound(self):
print("Bark")
pet = Dog()
pet.sound()15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions