add example for "default constructor, copy constructor, destructor, if you need one you'll need all"

add smart pointer
add pointer pointer
This commit is contained in:
2025-03-27 21:37:30 +01:00
parent 4b6ac6a484
commit a557775853
11 changed files with 163 additions and 33 deletions
+8 -3
View File
@@ -1,19 +1,24 @@
#include "Ork.h"
#include <iostream>
Ork::Ork() : Monster(10)
{
std::cout << "Create Ork" << std::endl;
//this->_strength = 10;
this->name = "My Ork";
}
Ork::Ork(const Ork& other) : Monster(other._strength)
Ork::Ork(const Ork& other) : Monster(other)
{
this->name = other.name;
this->_speed = other._speed;
std::cout << "Create a copy of an Ork" << std::endl;
//this->name = other.name;
//this->_speed = other._speed;
}
Ork::~Ork()
{
std::cout << "Destroy Ork" << std::endl;
}
void Ork::Move()