



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




C++ Hybrid Inheritance
Half breed legacy is a mix of more than one sort of legacy.
C++ Legacy We should see a basic model:
#incorporate
class B : public A { secured: int b;
public: void get_b() { std::cout << "Enter the worth of 'b' : " << std::endl; cin>>b; } }; class C { secured: int c; public: void get_c() { std::cout << "Enter the worth of c is : " << std::endl; cin>>c; } };
class D : public B, public C { secured: int d; public: void mul()
C++ Legacy Language structure of Various leveled legacy:
class A { // body of the class A. } class B : public A { // assortment of class B. } class C : public A { // assortment of class C. } class D : public A { // assortment of class D. } We should see a basic model:
#incorporate
public: int a; int b; void get_data(int n,int m) { a= n; b = m; } }; class Square shape : public Shape//acquiring Shape class { public: int rect_area() { int result = ab; bring result back; } }; class Triangle : public Shape//acquiring Shape class { public: int triangle_area() { float result = 0.5a*b; bring result back;
Enter the base and level of the triangle: 2 5 Region of the triangle is : 5