In this HackerRank Inheritance Introduction problem in c++ you need to create a class derived from the base class Triangle called Isosceles and then write a function in Isosceles class that can handle the parent class's methods.

HackerRank Inheritance Introduction in C++ problem solution

HackerRank Inheritance Introduction 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";
       }
       void description()
       {
           cout << "In an isosceles triangle two sides are equal\n";
       }
};
int main(){
    Isosceles isc;
    isc.isosceles();
     isc.description();
    isc.triangle();
    return 0;
}