Inheritance

Let us try to understand the basics of inheritance with the help of below example. In this, we have created one class viz. person. This class has some basic information like age and name of a person. Now, let’s say that I want to create a student class. First option is that all the information we keep in the student class like age, name, roll number and standard. Other option is to keep the basic or common information in one class and use this class to form a student class.…