Skip to content

Commit

Permalink
Update enemy.cpp
Browse files Browse the repository at this point in the history
changed static_cast to dynamic_cast for polymorphism
  • Loading branch information
Jeff591 authored Nov 26, 2021
1 parent a8b8c95 commit be6e540
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion enemy.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "enemy.h"

int Enemy::attack(Character* opponent) {
Player* player = static_cast<Player*>(opponent);
Player* player = dynamic_cast<Player*>(opponent);
int damageDealt;
if(player->get_current_armor() == nullptr)
{
Expand Down

0 comments on commit be6e540

Please sign in to comment.