I have a problem in my code. It’s just the class. The whole code is under one class.Can it be converted to inheritance?like can it be converted to base and derive classes?
Here is the requirement of the question below…
Implement a class hierarchy in C++ with Number System as a base class and four derived classes to represent each of the four number systems mentioned above. Use this class hierarchy to implement a Number Conversion Calculator.
Your calculator should have the following features:

Take a number (in any of the four bases) and be able to convert it into a specified base.

To add, subtract, multiply and divide numbers (in any of the four bases) using operator overloading.
class NumberSystem
{
public:
int BinarytoDecimal()
{
long long num;
int decimalNum, i, rem;
cout << "Enter any binary number: ";
cin >> num;
decimalNum = 0;
i = 0;
//converting binary to decimal
while (num != 0)
{
rem = num % 10;
num /= 10;
decimalNum += rem * pow(2, i);
++i;
}
cout << "Equivalent Decimal number: " << decimalNum << endl;
return decimalNum;
}
{
long num, temp;
int oct(50), i = 1, j;
cout << "Enter a decimal number : ";
cin >> num;
temp = num;
while (temp != 0)
{
oct(i++) = temp % 8;
temp = temp / 8;
}
cout << "nOctal equivalent of " << num << " is : "<<oct(2)<<oct(1)<<endl;
for (j = i  1; j >= 0; j)
cout << oct(j);
return 0;
}
void OctaltoHexa()
{
int ar1(20), ar2(20), ar3(20);
int h, i, j, k, l, x, fr, flg, rem, n1, n3;
float rem1, n2, n4, dno;
char octal_num(20);
x = fr = flg = rem = 0;
rem1 = 0.0;
cout << "nn Convert any octal number to a hexadecimal number:n";
cout << "n";
cout << " Input any octal number: ";
cin >> octal_num;
for (i = 0, j = 0, k = 0; i < strlen(octal_num); i++)
{
if (octal_num(i) == '.')
{
flg = 1;
}
else if (flg == 0)
ar1(j++) = octal_num(i)  48;
else if (flg == 1)
ar2(k++) = octal_num(i)  48;
}
x = j;
fr = k;
for (j = 0, i = x  1; j < x; j++, i)
{
rem = rem + (ar1(j) * pow(8, i));
}
for (k = 0, i = 1; k < fr; k++, i++)
{
rem1 = rem1 + (ar2(k) / pow(8, i));
}
rem1 = rem + rem1;
dno = rem1;
n1 = (int)dno;
n2 = dno  n1;
i = 0;
while (n1 != 0)
{
rem = n1 % 16;
ar3(i) = rem;
n1 = n1 / 16;
i++;
}
j = 0;
while (n2 != 0.0)
{
n2 = n2 * 16;
n3 = (int)n2;
n4 = n2  n3;
n2 = n4;
ar1(j) = n3;
j++;
if (j == 4)
{
break;
}
}
l = i;
cout << " The hexadecimal value of " << octal_num << " is: ";
for (i = l  1; i >= 0; i)
{
if (ar3(i) == 10)
cout << "A";
else if (ar3(i) == 11)
cout << "B";
else if (ar3(i) == 12)
cout << "C";
else if (ar3(i) == 13)
cout << "D";
else if (ar3(i) == 14)
cout << "E";
else if (ar3(i) == 15)
cout << "F";
else
cout << ar3(i);
}
h = j;
cout << ".";
for (k = 0; k < h; k++)
{
if (ar1(k) == 10)
cout << "A";
else if (ar1(k) == 11)
cout << "B";
else if (ar1(k) == 12)
cout << "C";
else if (ar1(k) == 13)
cout << "D";
else if (ar1(k) == 14)
cout << "E";
else if (ar1(k) == 15)
cout << "F";
else
cout << ar1(k);
}
cout << endl;
}
};