Detrmining depth in class hierarchy