#include <iostream>
using namespace std; 
class A 
{
    public:
    int x; 
    void getx()
    {
        cout<<"Enter the value of x: ";
        cin >>x; 
        cout<<x<<endl; 
    }
};
class B 
{
    public :
    int y; 
    void gety()
    {
        cout<<"Enter the value of y: ";
        cin>>y; 
        cout<<y<<endl; 
    }
};
class C:public A, public B 
{
    public :
    void sum()
    {
    cout <<"sum= "<<x+y;
    }
};
int main() {
    C obj; 
    obj. getx();
    obj. gety();
    obj. sum();
    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: