14

From an OOP point of view is there any difference between a derived class and an inherited class? Or is it simply terminology?

j.i.h.
  • 815
  • 8
  • 29
JL.
  • 78,954
  • 126
  • 311
  • 459

5 Answers5

16

When using inheritance, the inherited class is called the base class, and the inheriting class is called the derived class.

Anton Kuzmin
  • 821
  • 1
  • 10
  • 26
  • 1
    Completely changing te text of your answer to mirror another user's answer is not considered good form here on SO. –  Jan 16 '10 at 11:23
  • @Neil: On the contrary. Editing your answer to make it the best possible answer is what SO is all about. Of course that plagiarizing is not nice, but I find the edit an improvement based on your answer, not a blatant copy, especially since your answer was C++ specific (there was no need to make it specific, but you did.) – Vinko Vrsalovic Jan 16 '10 at 11:31
  • @Vinko There was a need need to make it specific - different languages use different nomenclatures. For example, a Smalltalk programmer would talk about superclass and subclass rather than base and derived. –  Jan 16 '10 at 11:35
  • 1
    @Neil: Well then, if you think so you now have an opportunity to improve your answer and make it better than the answer based on your own. – Vinko Vrsalovic Jan 16 '10 at 11:40
  • BTW, given the question, I don't think there is a need to be language specific. The question is about inherited and derived and, while some languages might out front not use those terms at all, I doubt there is any language where the terms are used and represent different things. In case such language existed, that would be a worthy addition to an answer. – Vinko Vrsalovic Jan 16 '10 at 11:42
  • I changed my answer because I realized I was wrong when I was googling a bit just to make sure I wrote a correct answer. – Anton Kuzmin Jan 16 '10 at 13:38
5

The term derived class is preferred C++ parlance for a class that inherits from another class, which in C++ parlance is called a base class. So in C++ the terms you ask about are identical.

2

Neil's answer confused me a bit, and so I checked some public sources.

Consider a Base Class and a Sub Class (SubClass extends BaseClass in Java terminology), than

  • the Sub Class derives Base Class (Sub Class is a derived class of Base Class) and
  • the Sub Class inherits from Base Class (Base Class is a/the inherited class of Sub Class)

So in my opinion both terms define the same relationship between to classes but from different perspectives.

Andreas Dolk
  • 113,398
  • 19
  • 180
  • 268
  • The term subclass isn't commonly used in C++ - I don't know about Java - and the OP didn't ask about it. –  Jan 16 '10 at 11:32
0

Inheritance terminology by Bertran Meyer (Object-Oriented Software Construction, p.464):

Basic conventions and terminology

The following terms will be useful in addition to “heir” and “parent”.

A descendant of a class C is any class that inherits directly or indirectly from C, including C itself. (Formally: either C or, recursively, a descendant of an heir of C.) An ancestor of C is a class A such that C is a descendant of A.

In the literature you will also encounter the terms “subclass” and “superclass”, but we will stay away from them because they are ambiguous; sometimes “subclass” means heir (immediate descendant), sometimes it is used in the more general sense of proper descendant, and it is not always clear which. In addition, we will see that the “subset” connotation of this word is not always justified.

Sergey Teplyakov
  • 11,477
  • 34
  • 49
0

maybe interesting, if you override a method, in Delphi you write:

inherited; // so "inherited" is the base class

instead of

base.BaseImplementation(); // C#
Carsten
  • 9
  • 2