Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the opposite of a base class in OOP?

Tags:

oop

In object-oriented programming, a 'base class' is a class from which other classes have been derived (http://en.wikipedia.org/wiki/Base_class).

However, what is the opposite of a base class? In order words, what is a class that does NOT have any child classes called?

EDIT: I am looking for the name of a class that has not been sub-classed, YET, within an inheritance of tree of multiple parent classes, starting with a base class.

like image 550
archmeta Avatar asked Nov 14 '11 02:11

archmeta


People also ask

What is a base class in OOP?

What is a Base Class? In an object-oriented programming language, a base class is an existing class from which the other classes are determined and properties are inherited. It is also known as a superclass or parent class.

What is base and sub class?

Definitions: A class that is derived from another class is called a subclass (also a derived class, extended class, or child class). The class from which the subclass is derived is called a superclass (also a base class or a parent class).

Is Base and parent class same?

A base class is also called parent class or superclass. Derived Class: A class that is created from an existing class. The derived class inherits all members and member functions of a base class. The derived class can have more functionality with respect to the Base class and can easily access the Base class.

What is the other name of base class?

A base class may also be called parent class or superclass.


2 Answers

A base class is a relative term. It only applies when considering one of its derived classes. Here are some terms that I consider opposites (and mostly orthogonal among themselves):

  • base class vs derived class; similarly super class vs sub class
  • abstract class vs concrete class
  • root class vs leaf class
  • sealed (also, final) class vs inheritable (non-sealed) class
  • nested class vs top-level class

Abstract and (normally) root classes are designed to be base classes. Sealed classes cannot be base classes, because they're non-inheritable. A root class is a class without a base class (in C# and Java, this class is Object). A leaf class has no subclass, so it's not a base class; but it's not necessarily sealed. Sealed classes, on the other hand, are always leaf classes.

So,

I am looking for the name of a class that has not been sub-classed, YET

It seems that you're looking for a leaf class, but I don't consider it to be the opposite of a base class.

like image 146
Jordão Avatar answered Sep 20 '22 10:09

Jordão


I usually hear leaf class. Java enforces it with final.

like image 24
0x5f3759df Avatar answered Sep 17 '22 10:09

0x5f3759df