Talk:Complete roguelike tutorial using C++ and libtcod - part 6: going berserk!

From RogueBasin
Jump to navigation Jump to search

As written, in order to prevent memory leaks at this point in the tutorial the Actor class should implement a destructor that deletes the member pointers attacker, destructible, and ai off of the heap.

Actor.hpp:

Actor::~Actor() {
    delete attacker;
    delete destructible;
    delete ai;
};