What is the difference between a child of a parent class and the derived of a base class in VB.NET or C#?

Gravitate picture Gravitate · Oct 23, 2012 · Viewed 10.9k times · Source

After asking the question Call a method that requires a derived class instance typed as base class in VB.NET or C# on Stack Overflow, I was informed that I had used the wrong terms when asking the question. I had used "parent" and "child" where I should have used "base" and "derived" instead.

I have been unable to find a good description of the difference.

This is what I know (or think I know) so far:

A parent class contains the child class. Where as a derived class inherits from a base class.

They are similar because the child (or derived) can access the parents (or base) properties and methods (where allowed).

They are different because you can refer to a property of the child class in the form of Parent.Child.Property. Whereas you cannot do that with a derived class.

What is the difference and in what situation should one be used over the other?

Answer

CodesInChaos picture CodesInChaos · Oct 23, 2012

parent and child are more abstract relations. They are used to describe hierarchy, and thus can be used in all kinds of trees (or sometimes DAGs).
The tree of class inheritance is one such tree, so calling them parent and child is not wrong.
This terminology is often used with other kinds of trees, such as nested GUI controls, directory structures,...

base and derived is used only for inheritance, and thus more precise. This terminology is preferred, since it's less ambiguous.