About Lesson
If a class is derived from one parent class, then it is known as Single or single level inheritance. In this case only one parent and one child class can be seen.
//example code showing how single inheritance can be established
#include <iostream>
using namespace std;
class Student {
public:
float marks = 98.5;
};
class Employee: public Student {
public:
float sal = 50000;
};
int main(void) {
Employee e1;
cout<<“marks secured: “<<e1.marks<<endl;
cout<<“salary: “<<e1.sal<<endl;
return 0;
}