# HackerRank Inheritance Introduction solution in c++ programming

In this HackerRank Inheritance introduction problem in the c++ programming language, you need to write a function in Isosceles class such that the output is printed in the separated three lines.

## HackerRank Inheritance introduction problem solution in c++ programming.

```#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;
}```

## Second solution in c++14

```#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";
}
public:
void description(){
cout<<"In an isosceles triangle two sides are equal"<<endl;
}
};
int main(){
Isosceles isc;
isc.isosceles();
isc.description();
isc.triangle();
return 0;
}```