Question: Write a Python class called Animal that contains two private attributes: a name to store the name of the animal and a weight that will
Write a Python class called Animal that contains two private attributes: a name to store the name of the animal and a weight that will contain the weight of the Animal in Kilograms. Add a methods who(), that displays a messages giving the name and weight of the Animal object. Derive two classes named Lion and Monkey, using Animal as a base class. Create Lion and Monkey objects. Demonstrate that the who() method is inherited from Animal class. Add setter and getter methods
. Example objects : Leo at 101 Kg. Mandrill at 30 Kg
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
