#include <iostream>
using namespace std; 
class A 
{
    public :
    int x; 
};
class B : public A 
{
    public :
    B ()
    {
        x=10;
    }
};
class C 
{
    public :
    int y; 
    C ()
    {
        y=4;
    }
};
class D :public B, public C 
{
    public :
    void sum()
    {
        cout <<"Sum= "<<x+y<<endl; 
    }
};
int main() {
    D obj; 
    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: