Help about if statement in constraint block

In reply to dave_59:

Dave, Can you elaborate a little with an example?

I feel that its very difficult to create a new class for each packet type(by extending base calss).The user might end up in creating thousands of packet class even though they will be used only in 1 or 2 tests.