some more content
This commit is contained in:
18
.vscode/c_cpp_properties.json
vendored
Normal file
18
.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "linux-gcc-x64",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**"
|
||||||
|
],
|
||||||
|
"compilerPath": "/usr/bin/gcc",
|
||||||
|
"cStandard": "${default}",
|
||||||
|
"cppStandard": "${default}",
|
||||||
|
"intelliSenseMode": "linux-gcc-x64",
|
||||||
|
"compilerArgs": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
||||||
24
.vscode/launch.json
vendored
Normal file
24
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "C/C++ Runner: Debug Session",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"externalConsole": false,
|
||||||
|
"cwd": "/home/rattatwinko/Dokumente/CPP/CPP",
|
||||||
|
"program": "/home/rattatwinko/Dokumente/CPP/CPP/build/Debug/outDebug",
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"miDebuggerPath": "gdb",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
59
.vscode/settings.json
vendored
Normal file
59
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"C_Cpp_Runner.cCompilerPath": "gcc",
|
||||||
|
"C_Cpp_Runner.cppCompilerPath": "g++",
|
||||||
|
"C_Cpp_Runner.debuggerPath": "gdb",
|
||||||
|
"C_Cpp_Runner.cStandard": "",
|
||||||
|
"C_Cpp_Runner.cppStandard": "",
|
||||||
|
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat",
|
||||||
|
"C_Cpp_Runner.useMsvc": false,
|
||||||
|
"C_Cpp_Runner.warnings": [
|
||||||
|
"-Wall",
|
||||||
|
"-Wextra",
|
||||||
|
"-Wpedantic",
|
||||||
|
"-Wshadow",
|
||||||
|
"-Wformat=2",
|
||||||
|
"-Wcast-align",
|
||||||
|
"-Wconversion",
|
||||||
|
"-Wsign-conversion",
|
||||||
|
"-Wnull-dereference"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.msvcWarnings": [
|
||||||
|
"/W4",
|
||||||
|
"/permissive-",
|
||||||
|
"/w14242",
|
||||||
|
"/w14287",
|
||||||
|
"/w14296",
|
||||||
|
"/w14311",
|
||||||
|
"/w14826",
|
||||||
|
"/w44062",
|
||||||
|
"/w44242",
|
||||||
|
"/w14905",
|
||||||
|
"/w14906",
|
||||||
|
"/w14263",
|
||||||
|
"/w44265",
|
||||||
|
"/w14928"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.enableWarnings": true,
|
||||||
|
"C_Cpp_Runner.warningsAsError": false,
|
||||||
|
"C_Cpp_Runner.compilerArgs": [],
|
||||||
|
"C_Cpp_Runner.linkerArgs": [],
|
||||||
|
"C_Cpp_Runner.includePaths": [],
|
||||||
|
"C_Cpp_Runner.includeSearch": [
|
||||||
|
"*",
|
||||||
|
"**/*"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.excludeSearch": [
|
||||||
|
"**/build",
|
||||||
|
"**/build/**",
|
||||||
|
"**/.*",
|
||||||
|
"**/.*/**",
|
||||||
|
"**/.vscode",
|
||||||
|
"**/.vscode/**"
|
||||||
|
],
|
||||||
|
"C_Cpp_Runner.useAddressSanitizer": false,
|
||||||
|
"C_Cpp_Runner.useUndefinedSanitizer": false,
|
||||||
|
"C_Cpp_Runner.useLeakSanitizer": false,
|
||||||
|
"C_Cpp_Runner.showCompilationTime": false,
|
||||||
|
"C_Cpp_Runner.useLinkTimeOptimization": false,
|
||||||
|
"C_Cpp_Runner.msvcSecureNoWarnings": false
|
||||||
|
}
|
||||||
28
.vscode/tasks.json
vendored
Normal file
28
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "cppbuild",
|
||||||
|
"label": "C/C++: g++ build active file",
|
||||||
|
"command": "/usr/bin/g++",
|
||||||
|
"args": [
|
||||||
|
"-fdiagnostics-color=always",
|
||||||
|
"-g",
|
||||||
|
"${file}",
|
||||||
|
"-o",
|
||||||
|
"${fileDirname}/${fileBasenameNoExtension}"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"cwd": "${fileDirname}"
|
||||||
|
},
|
||||||
|
"problemMatcher": [
|
||||||
|
"$gcc"
|
||||||
|
],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"detail": "Task generated by Debugger."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": "2.0.0"
|
||||||
|
}
|
||||||
BIN
OOP/access_specifier/ex2
Executable file
BIN
OOP/access_specifier/ex2
Executable file
Binary file not shown.
33
OOP/access_specifier/ex2.cpp
Normal file
33
OOP/access_specifier/ex2.cpp
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Here we have the protected specifier which lets a class inherit a variable (in this example it is salary!)
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Employee {
|
||||||
|
protected:
|
||||||
|
int salary;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Programmer: public Employee {
|
||||||
|
public:
|
||||||
|
int bonus;
|
||||||
|
void setSalary(int s) {
|
||||||
|
salary = s;
|
||||||
|
}
|
||||||
|
int getSalary() {
|
||||||
|
return salary;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
Programmer classobj;
|
||||||
|
classobj.setSalary(1000);
|
||||||
|
classobj.bonus = 200;
|
||||||
|
|
||||||
|
cout << "Salary for Programmer Class: " << classobj.getSalary() << "\n";
|
||||||
|
cout << "Bonus for Programmer Class: " << classobj.bonus << "\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
OOP/constructor/car_outside
Executable file
BIN
OOP/constructor/car_outside
Executable file
Binary file not shown.
BIN
OOP/encapsulation/main
Executable file
BIN
OOP/encapsulation/main
Executable file
Binary file not shown.
24
OOP/encapsulation/main.cpp
Normal file
24
OOP/encapsulation/main.cpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class Employee {
|
||||||
|
private:
|
||||||
|
int salary;
|
||||||
|
public:
|
||||||
|
// Setter
|
||||||
|
void setSalary(int s) {
|
||||||
|
salary = s;
|
||||||
|
}
|
||||||
|
int getSalary() {
|
||||||
|
return salary;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
Employee myObj;
|
||||||
|
myObj.setSalary(123000);
|
||||||
|
cout << myObj.getSalary();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
OOP/inheritance/Vehicle
Executable file
BIN
OOP/inheritance/Vehicle
Executable file
Binary file not shown.
23
OOP/inheritance/Vehicle.cpp
Normal file
23
OOP/inheritance/Vehicle.cpp
Normal 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
BIN
OOP/inheritance/multilevel
Executable file
Binary file not shown.
24
OOP/inheritance/multilevel.cpp
Normal file
24
OOP/inheritance/multilevel.cpp
Normal 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;
|
||||||
|
}
|
||||||
BIN
OOP/inheritance/multiple_inheritance
Executable file
BIN
OOP/inheritance/multiple_inheritance
Executable file
Binary file not shown.
27
OOP/inheritance/multiple_inheritance.cpp
Normal file
27
OOP/inheritance/multiple_inheritance.cpp
Normal 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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user