Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions Lecture 13/C++ Code/DecoratorPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class CharacterDecorator : public Character {
CharacterDecorator(Character* c){
this->character = c;
}

virtual ~CharacterDecorator(){
delete character; // cleans up resources
};
};

// Concrete Decorator: Height-Increasing Power-Up.
Expand Down Expand Up @@ -58,10 +60,6 @@ class StarPowerUp : public CharacterDecorator {
string getAbilities() const override {
return character->getAbilities() + " with Star Power (Limited Time)";
}

~StarPowerUp() {
cout << "Destroying StarPowerUp Decorator" << endl;
}
};

int main() {
Expand Down