A generic semantic-based framework is presented for the definition and manipulation of class hierarchies for object-oriented languages. The framework is based on the notion of observable of a class, i.e. an abstraction of its semantics when focussing on a behavioral
property of interest. By exploiting such a notion, we define the semantic subclass relation, capturing the fact that a subclass preserves the behavior of its superclass up to a given (tunable) observed property. We study the relation between syntactic subclass, as
present in mainstream object-oriented languages, and the notion of semantic subclass. Such an approach is then extended to class hierarchies, leading to a semantic-based modular treatment of a suite of basic observable-preserving operators on hierarchies. We
instantiate the framework by presenting effective algorithms that compute a semantic superclass for two given classes, that extend a hierarchy with a new class, and that merge two hierarchies by preserving semantic subclass relations