diff --git a/CPlusPlus/CPlusPlus.sln b/CPlusPlus/CPlusPlus.sln index 9195293..467ad1f 100644 --- a/CPlusPlus/CPlusPlus.sln +++ b/CPlusPlus/CPlusPlus.sln @@ -1,10 +1,14 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.14.36414.22 d17.14 +VisualStudioVersion = 17.14.36414.22 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Intro", "Intro\Intro.vcxproj", "{9DDBE4CE-3B06-4877-8D9C-5F0FFD755DD5}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Forward_Declaration", "Forward_Declaration\Forward_Declaration.vcxproj", "{1A004ECB-CBB0-4769-90B8-5CAF2554D283}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Classes", "Classes\Classes.vcxproj", "{4949E46C-8711-4BEF-8919-4B818B823520}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM64 = Debug|ARM64 @@ -27,6 +31,30 @@ Global {9DDBE4CE-3B06-4877-8D9C-5F0FFD755DD5}.Release|x64.Build.0 = Release|x64 {9DDBE4CE-3B06-4877-8D9C-5F0FFD755DD5}.Release|x86.ActiveCfg = Release|Win32 {9DDBE4CE-3B06-4877-8D9C-5F0FFD755DD5}.Release|x86.Build.0 = Release|Win32 + {1A004ECB-CBB0-4769-90B8-5CAF2554D283}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {1A004ECB-CBB0-4769-90B8-5CAF2554D283}.Debug|ARM64.Build.0 = Debug|ARM64 + {1A004ECB-CBB0-4769-90B8-5CAF2554D283}.Debug|x64.ActiveCfg = Debug|x64 + {1A004ECB-CBB0-4769-90B8-5CAF2554D283}.Debug|x64.Build.0 = Debug|x64 + {1A004ECB-CBB0-4769-90B8-5CAF2554D283}.Debug|x86.ActiveCfg = Debug|Win32 + {1A004ECB-CBB0-4769-90B8-5CAF2554D283}.Debug|x86.Build.0 = Debug|Win32 + {1A004ECB-CBB0-4769-90B8-5CAF2554D283}.Release|ARM64.ActiveCfg = Release|ARM64 + {1A004ECB-CBB0-4769-90B8-5CAF2554D283}.Release|ARM64.Build.0 = Release|ARM64 + {1A004ECB-CBB0-4769-90B8-5CAF2554D283}.Release|x64.ActiveCfg = Release|x64 + {1A004ECB-CBB0-4769-90B8-5CAF2554D283}.Release|x64.Build.0 = Release|x64 + {1A004ECB-CBB0-4769-90B8-5CAF2554D283}.Release|x86.ActiveCfg = Release|Win32 + {1A004ECB-CBB0-4769-90B8-5CAF2554D283}.Release|x86.Build.0 = Release|Win32 + {4949E46C-8711-4BEF-8919-4B818B823520}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {4949E46C-8711-4BEF-8919-4B818B823520}.Debug|ARM64.Build.0 = Debug|ARM64 + {4949E46C-8711-4BEF-8919-4B818B823520}.Debug|x64.ActiveCfg = Debug|x64 + {4949E46C-8711-4BEF-8919-4B818B823520}.Debug|x64.Build.0 = Debug|x64 + {4949E46C-8711-4BEF-8919-4B818B823520}.Debug|x86.ActiveCfg = Debug|Win32 + {4949E46C-8711-4BEF-8919-4B818B823520}.Debug|x86.Build.0 = Debug|Win32 + {4949E46C-8711-4BEF-8919-4B818B823520}.Release|ARM64.ActiveCfg = Release|ARM64 + {4949E46C-8711-4BEF-8919-4B818B823520}.Release|ARM64.Build.0 = Release|ARM64 + {4949E46C-8711-4BEF-8919-4B818B823520}.Release|x64.ActiveCfg = Release|x64 + {4949E46C-8711-4BEF-8919-4B818B823520}.Release|x64.Build.0 = Release|x64 + {4949E46C-8711-4BEF-8919-4B818B823520}.Release|x86.ActiveCfg = Release|Win32 + {4949E46C-8711-4BEF-8919-4B818B823520}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CPlusPlus/Classes/Classes.vcxproj b/CPlusPlus/Classes/Classes.vcxproj new file mode 100644 index 0000000..f058bf7 --- /dev/null +++ b/CPlusPlus/Classes/Classes.vcxproj @@ -0,0 +1,195 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM64 + + + Release + ARM64 + + + + 17.0 + Win32Proj + {4949e46c-8711-4bef-8919-4b818b823520} + Classes + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CPlusPlus/Classes/Classes.vcxproj.filters b/CPlusPlus/Classes/Classes.vcxproj.filters new file mode 100644 index 0000000..b33eb78 --- /dev/null +++ b/CPlusPlus/Classes/Classes.vcxproj.filters @@ -0,0 +1,51 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/CPlusPlus/Classes/Entity.cpp b/CPlusPlus/Classes/Entity.cpp new file mode 100644 index 0000000..e92cee5 --- /dev/null +++ b/CPlusPlus/Classes/Entity.cpp @@ -0,0 +1,10 @@ +#include "Entity.h" +using namespace MyNamespace; + +Entity::Entity() // constructor definition +{ } + +Entity::Entity(std::string n) : _name(n) +{ + //_name = n; +} \ No newline at end of file diff --git a/CPlusPlus/Classes/Entity.h b/CPlusPlus/Classes/Entity.h new file mode 100644 index 0000000..b646334 --- /dev/null +++ b/CPlusPlus/Classes/Entity.h @@ -0,0 +1,19 @@ +#pragma once +#include + +namespace MyNamespace +{ + class Entity + { + public: + Entity(); // constructor declaration + Entity(std::string n); + + virtual std::string ToString() { return "Entity"; } // defined + void setName(std::string n) { _name = n; } // defined + std::string getName() { return _name; } + + protected: + std::string _name = ""; + }; // IMPORTANT: semicolon at the end +} \ No newline at end of file diff --git a/CPlusPlus/Classes/Monster.cpp b/CPlusPlus/Classes/Monster.cpp new file mode 100644 index 0000000..df69f4e --- /dev/null +++ b/CPlusPlus/Classes/Monster.cpp @@ -0,0 +1,6 @@ +#include "Monster.h" + +Monster::Monster() +{ + //ToString(); +} diff --git a/CPlusPlus/Classes/Monster.h b/CPlusPlus/Classes/Monster.h new file mode 100644 index 0000000..5e1550e --- /dev/null +++ b/CPlusPlus/Classes/Monster.h @@ -0,0 +1,10 @@ +#pragma once +#include "Entity.h" + +class Monster : public MyNamespace::Entity +{ +public: + Monster(); + + std::string ToString() override { return "Monster"; } +}; \ No newline at end of file diff --git a/CPlusPlus/Classes/Ork.cpp b/CPlusPlus/Classes/Ork.cpp new file mode 100644 index 0000000..eb197d9 --- /dev/null +++ b/CPlusPlus/Classes/Ork.cpp @@ -0,0 +1,6 @@ +#include "Ork.h" + +Ork::Ork() +{ + //ToString(); +} diff --git a/CPlusPlus/Classes/Ork.h b/CPlusPlus/Classes/Ork.h new file mode 100644 index 0000000..7ec2465 --- /dev/null +++ b/CPlusPlus/Classes/Ork.h @@ -0,0 +1,10 @@ +#pragma once +#include "Monster.h" + +class Ork : public Monster +{ +public: + Ork(); + + std::string ToString() override { return "Ork"; } +}; \ No newline at end of file diff --git a/CPlusPlus/Classes/Vector3.h b/CPlusPlus/Classes/Vector3.h new file mode 100644 index 0000000..139cab9 --- /dev/null +++ b/CPlusPlus/Classes/Vector3.h @@ -0,0 +1,11 @@ +#pragma once + +struct Vector3 +{ + float x; + float y; + float z; + + Vector3() : x(0.0f), y(0.0f), z(0.0f) {} + Vector3(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {} +}; \ No newline at end of file diff --git a/CPlusPlus/Classes/Weapon.cpp b/CPlusPlus/Classes/Weapon.cpp new file mode 100644 index 0000000..7e71249 --- /dev/null +++ b/CPlusPlus/Classes/Weapon.cpp @@ -0,0 +1 @@ +#include "Weapon.h" diff --git a/CPlusPlus/Classes/Weapon.h b/CPlusPlus/Classes/Weapon.h new file mode 100644 index 0000000..087835d --- /dev/null +++ b/CPlusPlus/Classes/Weapon.h @@ -0,0 +1,6 @@ +#pragma once + +class Weapon +{ +}; + diff --git a/CPlusPlus/Classes/main.cpp b/CPlusPlus/Classes/main.cpp new file mode 100644 index 0000000..255d146 --- /dev/null +++ b/CPlusPlus/Classes/main.cpp @@ -0,0 +1,22 @@ +#include +#include "Entity.h" +#include "Monster.h" +#include "Vector3.h" + +using namespace MyNamespace; +using namespace std; + +int main() +{ + Entity entity; // this is an instance + cout << entity.ToString() << endl; + + Monster monster; + cout << monster.ToString() << endl; + + Vector3 position(1.0f, 0.0f, 2.0f); + Vector3 position2 = Vector3(); + Vector3 position3{}; // list-initializer + + return 0; +} \ No newline at end of file diff --git a/CPlusPlus/Forward_Declaration/Forward_Declaration.vcxproj b/CPlusPlus/Forward_Declaration/Forward_Declaration.vcxproj new file mode 100644 index 0000000..7f17148 --- /dev/null +++ b/CPlusPlus/Forward_Declaration/Forward_Declaration.vcxproj @@ -0,0 +1,188 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM64 + + + Release + ARM64 + + + + 17.0 + Win32Proj + {1a004ecb-cbb0-4769-90b8-5caf2554d283} + ForwardDeclaration + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + + + + + + + + + \ No newline at end of file diff --git a/CPlusPlus/Forward_Declaration/Forward_Declaration.vcxproj.filters b/CPlusPlus/Forward_Declaration/Forward_Declaration.vcxproj.filters new file mode 100644 index 0000000..54bcd79 --- /dev/null +++ b/CPlusPlus/Forward_Declaration/Forward_Declaration.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff --git a/CPlusPlus/Forward_Declaration/functions.cpp b/CPlusPlus/Forward_Declaration/functions.cpp new file mode 100644 index 0000000..f40f06d --- /dev/null +++ b/CPlusPlus/Forward_Declaration/functions.cpp @@ -0,0 +1,5 @@ +#include "functions.h" // project based includes, project wide search first +#include // system based includes, system wide search first + +void functionE() // defined +{ } \ No newline at end of file diff --git a/CPlusPlus/Forward_Declaration/functions.h b/CPlusPlus/Forward_Declaration/functions.h new file mode 100644 index 0000000..d7b30f6 --- /dev/null +++ b/CPlusPlus/Forward_Declaration/functions.h @@ -0,0 +1,9 @@ +#pragma once + +#ifndef _FUNCTIONS_H_ +#define _FUNCTIONS_H_ + +void functionE(); // declare +//void functionF() {} // declare & defined, linker error when included in multiple source files + +#endif // _FUNCTIONS_H_ diff --git a/CPlusPlus/Forward_Declaration/main.cpp b/CPlusPlus/Forward_Declaration/main.cpp new file mode 100644 index 0000000..df11b34 --- /dev/null +++ b/CPlusPlus/Forward_Declaration/main.cpp @@ -0,0 +1,20 @@ +#include "functions.h" + +void functionB() {} // declared & defined +void functionC(); // declare +void functionD(); // declare + +int main() +{ + //functionA(); // compiler error, because function is declared & defined after this call + functionB(); // no error + //functionC(); // linker error, because function is declared, but not defined + functionD(); // no error + functionE(); // no error + + return 0; +} + +void functionA() {} // declare & defined + +void functionD() {} // defined \ No newline at end of file diff --git a/CPlusPlus/Intro/main.cpp b/CPlusPlus/Intro/main.cpp index 4bac0a5..009b01d 100644 --- a/CPlusPlus/Intro/main.cpp +++ b/CPlusPlus/Intro/main.cpp @@ -1,11 +1,26 @@ #include +using namespace std; + int main() { + // console output std::cout << "Hello World" << std::endl; std::cout << 1234 << std::endl; std::cout << L"Noch ein Test!\n"; // wide string literal, cout can not handle this std::cout << "Hello World" - 1234 << std::endl; // see pointer + int number = 10; + + cout << "number: " << number << endl; + + // console input + cin >> number; + cout << "input: " << number << endl; + + char c; + cin >> c; + cout << "input: " << c << endl; + return 0; } \ No newline at end of file