Delegates and the Observer Pattern

An overview of the options we have for building flexible notification systems between game components

Ryan McCombe
Updated
Hello! I'm here to help you with any questions about this lesson. Feel free to ask me anything - whether it's about specific concepts, examples, or how to apply what you've learned!

Questions & Answers

Answers are generated by AI models and may not have been reviewed. Be mindful when running any code on your device.

Why Use Delegates?
Why do we need to use delegates instead of just calling functions directly?
Delegate Performance Impact
How does the performance of delegates compare to direct function calls?
Handling Multiple Event Types
Can I have an observer observe multiple different types of events from the same subject?
Pausing Observer Notifications
Is it possible to temporarily pause notifications to specific observers?
std::function vs Function Pointer Performance
What's the overhead of using std::function compared to raw function pointers?
Smart Pointers with Observers
Can I use smart pointers to automatically manage observer registration/unregistration?
Observer Pattern Without Dynamic Allocation
Is it possible to implement the observer pattern without dynamic memory allocation?