In this HackerRank Multi Level Inheritance problem in c++, we need to create a class called Equilateral which inherits from Isosceles and should have a function such that the output is printed as aspected.

HackerRank Multi Level Inheritance in C++ problem solution

HackerRank Multi-Level Inheritance in C++ problem solution

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

class Triangle{
   public:
      void triangle(){
         cout<<"I am a triangle\n";
      }
};

class Isosceles : public Triangle{
     public:
        void isosceles(){
          cout<<"I am an isosceles triangle\n";
        }
};

class Equilateral : public Triangle
{
    public:
        void equilateral()
        {
            cout << "I am an equilateral triangle\n";
        }
        void isosceles()
        {
          cout<<"I am an isosceles triangle\n";
        }
};
   
//Write your code here.
int main(){
    Equilateral eqr;
     eqr.equilateral();
    eqr.isosceles();
    eqr.triangle();
    return 0;
}