Start learning 50% faster. Sign in now
In this code, the Dog class inherits from the Animal class, and it overrides the sound() method. This is a clear example of inheritance and method overriding in object-oriented programming. Let's break down the code and explain why A is correct and the other options are wrong: · Explanation of Correct Option (A): The Dog class extends the Animal class, which means it inherits the sound() method from Animal . However, Dog provides its own version of sound() , printing "Dog barks" instead of "Animal makes a sound". This is method overriding : a subclass providing a specific implementation of a method that was already defined in its superclass. Method overriding allows the subclass to provide its own version of the inherited method. · Why the Other Options Are Incorrect:
Which of the following Day is not observed in May?
Recently President of India Inaugurated Economic Democracy Conclave in :
The headquarter of International Cricket Council is located at:
Who was appointed as the Chairman and CEO of the Railway Board in August 2024?
Which country has recently elevated its relationship with India to a Comprehensive Strategic Partnership?
National Civil Service Day is celebrated on which date?
Who is the brand ambassador of Arogya Setu app?
In which state of the country, the 50th All India Police Science Conference inaugrated?
What is a Follow-on Public Offer (FPO)?