diff options
Reworked yesterdays oop practice folder structure
3 files changed, 35 insertions, 0 deletions
diff --git a/Year 1/Object-oriented Programming/06-Practice-29.03.2022/ex1/Entity.cpp b/Year 1/Object-oriented Programming/06-Practice-29.03.2022/ex1/Entity.cpp new file mode 100644 index 0000000..a4ad52e --- /dev/null +++ b/Year 1/Object-oriented Programming/06-Practice-29.03.2022/ex1/Entity.cpp @@ -0,0 +1,14 @@ +#include "Entity.h" +#include <iostream> + +Entity::Entity() { + x = 0; + std::cout << "Entity created!"; +} +Entity::Entity(int xVal) { + x = xVal; +} + +Entity::~Entity() { + std::cout << "Entity destroyed"; +} diff --git a/Year 1/Object-oriented Programming/06-Practice-29.03.2022/ex1/Entity.h b/Year 1/Object-oriented Programming/06-Practice-29.03.2022/ex1/Entity.h new file mode 100644 index 0000000..89c8d3f --- /dev/null +++ b/Year 1/Object-oriented Programming/06-Practice-29.03.2022/ex1/Entity.h @@ -0,0 +1,13 @@ +#ifndef ENTITY_HEADER +#define ENTITY_HEADER + +class Entity { +private: + int x; +public: + Entity(); + Entity(int xVal); + ~Entity(); +}; + +#endif // !ENTITY_HEADER diff --git a/Year 1/Object-oriented Programming/06-Practice-29.03.2022/ex1/Source.cpp b/Year 1/Object-oriented Programming/06-Practice-29.03.2022/ex1/Source.cpp new file mode 100644 index 0000000..5dd73a8 --- /dev/null +++ b/Year 1/Object-oriented Programming/06-Practice-29.03.2022/ex1/Source.cpp @@ -0,0 +1,8 @@ +#include "Entity.h" + +int main() { + Entity f; + Entity s(10); + Entity* t = new Entity; + Entity x(); +} |
