The Bridge
Decoupling a magical abstraction from its elemental implementation.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Bridge
ARCANUM SCHOOL: Evocation // Channeling
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// EXECUTABLE C++ PATTERN //
class Element {
public: virtual ~Element() = default; virtual void Ignite() = 0;
};
class FireElement : public Element {
public: void Ignite() override {}
};
class Spell {
protected: Element* element;
public:
Spell(Element* el) : element(el) {}
virtual void Execute() = 0;
};
class Fireball : public Spell {
public:
Fireball(Element* el) : Spell(el) {}
void Execute() override { element->Ignite(); }
};
Runic Tags:
#structural
#bridge
#cpp