add smart pointers

add polymorphism
add destructor & copy constructor
add pointer-pointer
This commit is contained in:
2025-09-22 18:22:03 +02:00
parent d8f6014fab
commit 3b35b973c9
13 changed files with 208 additions and 7 deletions
+14 -1
View File
@@ -1,11 +1,24 @@
#pragma once
#include "Entity.h"
#include "ICompareable.h"
#include "Vector3.h"
#include "Weapon.h"
class Monster : public Entity
class Monster : public Entity, public ICompareable
{
public:
// default constructor, copy constructor & destructor if you need one you'll need all of them
// internal pointers often requires default & copy constructor & a destructor at the same time
Monster();
Monster(const Monster& other); // copy constructor
virtual ~Monster();
std::string toString() override { return "Monster"; }
virtual void Move(Vector3 move) = 0;
int Compare(ICompareable* pOther) override;
private:
Weapon* _pWeapon = nullptr;
};