Define a common interface without dynamic polymorphism
In applications such as ray tracing, an entity can be one of several types, which all share a common interface. For example, a Material
can either be a DiffuseMaterial
or a ReflectiveMaterial
, etc and they all support a method Color getColor(args);
In most applications, this issue is typically resolved using dynamic polymorphism: