Semantic Types for Class-based Objects