0

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?

Daniel Wolf
  • 12,855
  • 13
  • 54
  • 80
  • You're overthinking it. _Derived_ , _child_ , _subclass_ are all valid terms which tell you the fact the class B/C/D/E inherits A. Direct or indirect descendent, it shouldn't matter in practice because of the Liskov Substitution Principle – MikeSW Jan 18 '14 at 07:39

1 Answers1

0

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.

user2105505
  • 686
  • 1
  • 9
  • 18
  • This would mean that the term "subclass"/"superclass" in itself is ambiguous. To be specific, one would have to say "direct" vs. "indirect" subclass/superclass. Makes sense to me. – Daniel Wolf Jan 18 '14 at 10:22