Find The Addition, Subtraction, Multiplication, Division Of Two Number Using Multiple Inheritance Programing In C++
Just Copy And paste This Code
_____________________________________________________
// Add,Sub,Mul,Div Using Multiple Inheritance
#include<iostream.h>
#include<conio.h>
class A
{
public:
int x;
void getx()
{
cout << "enter value of x: "; cin >> x;
}
};
class B
{
public:
int y;
void gety()
{
cout << "enter value of y: "; cin >> y;
}
};
class C : public A, public B //C is derived from class A and class B
{
public:
void arithmetic()
{
cout << "add= " << x+y<<endl;
cout << "Sub= " << x-y<<endl;
cout << "mul= " << x*y<<endl;
cout << "div= " << x / y;
}
};
void main()
{
C obj1; //object of derived class C
clrscr();
obj1.getx();
obj1.gety();
obj1.arithmetic();
getch();
} //end of program
_____________________________________________________
Run This Program Using Turbo C++ in Pc Or TurboCdroid in Android It Will Work
#DigitaliseData
#C++Programing
1 Comments
super bro , good explanation
ReplyDelete