Relative Content

Tag Archive for design

Removing dependencies on subclass-specific behavior

I have a Message class which can contain multiple types of payloads (or sometimes no payload), each derived from a common Payload class. However, this becomes problematic because the Message class wants to know about the Payload subclasses for various reasons such as: