Help with C++ Programming ? Someone please explain me this simple C++ inheritence program step by step ?

please help me to figure out this inheritence program , please tell me whether this program is correct or not? I am able to compile and run this but i have a doubt whether the inheritence is actually happening or not?
please explain step by step..

THANKS A TON

#include<iostream>
using namespace std;
class mmorpg{
public:

int firstmmo()
{
char x[20];
char y[20];
cin>>x>>y;
cout<<“Wow you enetered two MMORPG games names which are : “<<x <<” and “<<y <<” Appreciated”<<endl;
}

int secondmmo()
{
char a[20];
char b[25];
cout<<“Enter the second MMO’s”<<endl;
cin>>a>>b;
cout<<“The second MMO’s are ” <<a<<” and “<<b<<” Goodly Appreciated matsey boy”<<endl;
}
};

class mmorpg2 : public mmorpg{
public:
mmorpg::firstmmo;
mmorpg::secondmmo;
};

int main()
{
mmorpg2 games;
games.firstmmo();
games.secondmmo();
}

✅ Answers

? Best Answer

  • Inheritance just derives the properties of the main or super class into the base or sub class.
  • Leave a Comment