scitools.com

← Metric catalog

Base Classes is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.

Base Classes

API ID: CountClassBase
Also Known As: IFANIN
Languages: Basic, C#, C++, Java, Pascal, Python, Web
Targets: Classes

Number of immediate base classes.

Every class listed directly in this class's inheritance list counts, regardless of whether it's inherited publicly, privately, or protectedly.

For example:

class Vehicle {
public:
  Vehicle() {}
};

class Wheeled : public Vehicle {
  ...
};

class Car : public Wheeled {
  ...
};

class Boat : public Vehicle {
  ...
};

class DualPurpose {
  ...
};

class BoatCar: private Car, public Boat, protected DualPurpose {
  ...
};

BoatCar lists three direct base classes on its inheritance list — Car (private), Boat (public), and DualPurpose (protected) — so CountClassBase = 3. The access level used for each base doesn't change whether it's counted.

See Derived Classes for the reverse relationship, and Max Inheritance Tree for how deep the full inheritance chain runs.

Also known as IFANIN.


Targets By Language: Configuration: