0% found this document useful (0 votes)
26 views7 pages

C Language

Uploaded by

joshvongy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views7 pages

C Language

Uploaded by

joshvongy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

1111111111111111111 Single int

#include <iostream>

using namespace std;

class A {

public:

void habit() {

cout << "Love to eat banana";

};

class B : public A {

public:

void habit2() {

cout << "Love to eat apple";

};

int main() {

B alpha;

alpha.habit();

alpha.habit2();

return 0;

222222222222222222222222222222222222222 Multiple int


#include <iostream>

using namespace std;

class A {

public:
void habit() {

cout << "\nLove to eat banana\n";

};

class B : public A {

public:

void habit2() {

cout << "\nLove to eat apple\n";

};

class C : public B {

public:

void hab() {

cout <<"\nLove to eat grape\n";

};

int main() {

B alpha;

alpha.habit();

alpha.habit2();

alpha.hab();

return 0;

33333333333333333333 MULITI LEVEL INT ##############


#include <iostream>

using namespace std;

class A {

public:
void habit() {

cout << "Love to eat banana" << endl;

};

class B {

public:

void habit2() {

cout << "Love to eat apple" << endl;

};

class C : public A, public B {

public:

void habit3() {

cout << "Love to eat grapes" << endl;

};

int main() {

C gamma;

gamma.habit();

gamma.habit2();

gamma.habit3();

return 0;

4444444444444 Multipath int


#include <iostream>

using namespace std;


class A {

public:

void habit() {

cout << "Love to eat banana" << endl;

};

class B : public A {

public:

void habit2() {

cout << "Love to eat apple" << endl;

};

class C : public A {

public:

void habit3() {

cout << "Love to eat grapes" << endl;

};

class D : public B, public C {

public:

void habit4() {

cout << "Love to eat mangoes" << endl;

};

int main() {

D gamma;

gamma.habit2();

gamma.habit3();
gamma.habit4();

return 0;

Hybrid int 555555555555555555555555555555555555555555


#include <iostream>

using namespace std;

class A {

public:

void habit() {

cout << "Love to eat banana" << endl;

};

class B : public A {

public:

void habit2() {

cout << "Love to eat apple" << endl;

};

class C {

public:

void habit3() {

cout << "Love to eat grapes" << endl;

};

class D : public B, public C {

public:
void habit4() {

cout << "Love to eat mango" << endl;

};

int main() {

D delta;

delta.habit(); // for class a

delta.habit2(); // Accessing habit2() from class B

delta.habit3(); // Accessing habit3() from class C

delta.habit4(); // Accessing habit4() from class D

return 0;

66666666666666666666666 Hirechecal
int #include <iostream>

using namespace std;

class A {

public:

void habit() {

cout << "Love to eat banana" << endl;

};

class B : public A {

public:

void habit2() {

cout << "Love to eat apple" << endl;

};
class C : public A {

public:

void habit3() {

cout << "Love to eat grapes" << endl;

};

int main() {

B beta;

C gamma;

beta.habit(); // Accessing habit() from class A via class B

beta.habit2(); // Accessing habit2() from class B

gamma.habit(); // Accessing habit() from class A via class C

gamma.habit3(); // Accessing habit3() from class C

return 0;

You might also like