Thursday, 4 May 2017

AIM:Write a C++ program to implement following types of Inheritances:1) Hybrid Inheritances.2) Multilevel Inheritance.

 CODING:
//Hybrid Inheritance.
#include<iostream.h>
#include<conio.h>
class A
{
public:
int a;
};
class B: public A
{
public:
int b;
};
class D
{
public:
int d;
};
class C: public B,public D
{
public:
void add()
{
a=2,b=3,d=5;
int c=a+b+d;
cout<<"Addition is ="<<c;
}
};
main()
{
clrscr();
C c;
void add();
getch();
return(0);

}

No comments:

Post a Comment

About Me

Hi, I am Prof. Amol Zade, working in the field of teaching and research from last more than 10 years. My area of interests are Artificial Intelligence, Wireless Networking, Algorithms. I have 16 International paper publications along with 4 International Conference; also 3 Books published. published on Object Oriented Programming with open source approach.