scitools.com

← Metric catalog

Derived 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.

Derived Classes

API ID: CountClassDerived
Also Known As: Number of Children (NOC)
Languages: Basic, C#, C++, Java, Pascal, Python, Web
Targets: Classes

Number of immediate subclasses.

(i.e. the number of classes one level down the inheritance tree from this class).

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 {
  ...
};

class TourBoatCar : public BoatCar {};
class WildLifeTourBoatCar: public TourBoatCar {};

Only TourBoatCar derives directly from BoatCar, so CountClassDerived = 1 for BoatCar. WildLifeTourBoatCar derives from TourBoatCar, not directly from BoatCar, so it doesn't count here even though it's a "grandchild" further down the same tree.

See Base Classes for the reverse relationship.

Also known as Chidamber & Kemerer - Number of Children (NOC).


Targets By Language: Configuration: