Skip to main content
See comments
Source Link
Simon B
  • 9.7k
  • 4
  • 29
  • 34

The usual solution is the one you have abandoned, which is generally summarized as "prefer containmentcomposition over inheritance".

Create a simple class, which has a container to hold the special values. That container could be a dictionary/map, which is effectively a collection of name+value pairs. If you use the right container, querying it can be reasonably fast.

The usual solution is the one you have abandoned, which is generally summarized as "prefer containment over inheritance".

Create a simple class, which has a container to hold the special values. That container could be a dictionary/map, which is effectively a collection of name+value pairs. If you use the right container, querying it can be reasonably fast.

The usual solution is the one you have abandoned, which is generally summarized as "prefer composition over inheritance".

Create a simple class, which has a container to hold the special values. That container could be a dictionary/map, which is effectively a collection of name+value pairs. If you use the right container, querying it can be reasonably fast.

Source Link
Simon B
  • 9.7k
  • 4
  • 29
  • 34

The usual solution is the one you have abandoned, which is generally summarized as "prefer containment over inheritance".

Create a simple class, which has a container to hold the special values. That container could be a dictionary/map, which is effectively a collection of name+value pairs. If you use the right container, querying it can be reasonably fast.