문제

I'm familiar with the practical aspects of OOP. Now I'm writing a technical document and I'm questioning my use of terms.

enter image description here

Take this class hierarchy. Each class has zero, one, or more (multiple inheritance) classes it directly derives from. For B, this is A. I'd say that A is B's base class or superclass (interchangeably).

Conversely, a class can have any number of classes directly deriving from it. I'd say that B and C are A's derived classes or subclasses, again interchangeably.

Yet there must also be a term to refer to all classes a class directly or indirectly inherits from. How would you call {A, B} from D's perspective?

And I'm missing another term for all classes directly or indirectly derived from a class. How would you call {B, C, D, E} from A's perspective?

도움이 되었습니까?

해결책

Good questions. In this case, A is the root class, as all other classes inherit from it. All objects descend from A, or are either direct or indirect subclasses of A. The opposite is also true. B is a direct superclass of D and A is an indirect superclass. I suppose you could use the word ancestor as the opposite of descend/descendant, but I haven't seen this before.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top