Download

Difference between event and delegate

Who can explain me what the difference between DECLARE_EVENT and DECLARE_DYNAMIC_MULTICAST_DELEGATE, I didn’t catch. What is the profit of declare friend class in event scope, if I still can call Broadcast method from any place of code?

DOCS: While any class can bind events, only the class that declares the event may invoke the event’s Broadcast, IsBound, and Clear functions. This means event objects can be exposed in a public interface without worrying about giving external classes access to these sensitive functions.
https://docs.unrealengine.com/en-US/…nts/index.html



#define FUNC_DECLARE_EVENT( OwningType, EventName, ... ) \
class EventName : public TBaseMulticastDelegate<__VA_ARGS__> \
{ \
friend class OwningType; \
};


I’ve found the same question. **zeryzhang, **in his last comment, point out, it’s incomplete design for key functions encapsulation.