014-001-007

Multi-level Inheritance Implementation

Hard

Problem Description

Multi-level inheritance Implementation

In this problem, you will create a program that implements a 3-level inheritance hierarchy (Animal → Mammal → Dog), calls methods from each class in order, and displays the result to standard output.

Learning Objective: Understand and implement inheritance relationships across multiple levels

Overview

Implement a 3-level inheritance hierarchy (Animal -> Mammal -> Dog) and call methods from each level.

Specifications

  • Animal class: eat() method (outputs "Eating...")
  • Mammal class extends Animal: breathe() method (outputs "Breathing...")
  • Dog class extends Mammal: bark() method (outputs "Barking!")
  • Create Dog instance in Main class and call all three methods

Output Format

Eating...
Breathing...
Barking!

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up