exhaustive patterns for classes and traits