A class is a collection of data and methods. A class can inherit from another class, potentially adding more data…