some more content

This commit is contained in:
2025-04-30 16:54:56 +02:00
parent e7d74b2ee5
commit 611f3383f5
15 changed files with 260 additions and 0 deletions

BIN
OOP/inheritance/Vehicle Executable file

Binary file not shown.

View File

@@ -0,0 +1,23 @@
#include <iostream>
using namespace std;
class Vehicle {
public:
string brand = "Ford";
void honk() {
cout << "Honk Honk!";
}
};
class Car: public Vehicle {
public:
string model = "Mustang";
};
int main() {
Car myCar;
myCar.honk();
cout << myCar.brand + " " + myCar.model << "\n";
return 0;
}

BIN
OOP/inheritance/multilevel Executable file

Binary file not shown.

View File

@@ -0,0 +1,24 @@
#include <iostream>
using namespace std;
class Parent {
public:
void function() {
cout << "Parent Class!";
}
};
class MyChild: public Parent {
// Child Function here
};
class MyGrandChild: public MyChild {
// Grandchild Function here
};
int main() {
MyGrandChild classobj;
classobj.function();
return 0;
}

Binary file not shown.

View File

@@ -0,0 +1,27 @@
#include <iostream>
using namespace std;
class myClass {
public:
void myClass_one() {
cout << "Hello World!";
}
};
class MyOtherClass {
public:
void MyOtherClass_Function() {
cout << "Hello, I am a other Function!";
}
};
class myChildClass: public myClass, public MyOtherClass {
};
int main() {
myChildClass classobj;
classobj.myClass_one();
classobj.MyOtherClass_Function();
return 0;
}