Question: python Create a parent class Dog. Add 03 instance variables name, age and vaccine_status (True/False) of a dog object. The vaccine status by default should
- python
- Create a parent class Dog.
- Add 03 instance variables name, age and vaccine_status (True/False) of a dog object. The vaccine status by default should be False. Make sure you initialize the instance variables. create and initialize the class variable species with value "Canis familiaris".
- Write a special method __str__ to show the string representation of an object. The __str__ function should return the name and age information of the dog.
- Write another method speak that should return the string specifying "
says , sound should be the parameter of this method. - Add another method, vaccinate, that should change the value of vaccine_status.
- Write a sub-class GoldenRetriever, inherited form the parent class you just created.
- Override the method speak by adding the default sound to "Bark" and call the super class method speak in it.
- python
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
