C++ Hierarchical Inheritance

  c++

Email

#include<iostream>

using namespace std;

class A{

public :

void setaname()
{

cout << “this coding aniln”;
}
};

class B : public A {

public :
void setdate()
{
cout << “this main codingn”;
}
};

class C : public A {

public :

void stenamest()
{

cout << “this about of the main coding”;
}
};

class D : public A{
public :
void setnamed()
{

cout << “this whcih is th cding”;

}

};

int main()
{

D naik;
naik.setnamed();
naik.setaname();
B anil;
anil.setdate();
C kl;
kl.stenamest();

}

Spread the Code

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of