JohnL
JohnL

Reputation: 373

Design question with Enums to model Type relationships

In designing a class for customer for example would it make sense to use an Enum for CustomerType?

Upvotes: 0

Views: 154

Answers (1)

Konrad Rudolph
Konrad Rudolph

Reputation: 545686

That depends on other constraints. You haven't told us enough about your model. For example, if different types of customers have different types of information associated with them, a class hierarchy will be better suited that an a mere enum.

In other cases, an enum will be fine or might even be preferred (simpler, reduced overhead …).

Upvotes: 3

Related Questions