diff --git a/Inheritance CPP b/Inheritance CPP new file mode 100644 index 00000000..7b8e5b71 --- /dev/null +++ b/Inheritance CPP @@ -0,0 +1,71 @@ +#include +using namespace std; + +class employee +{ + private: + int eid; + string name; + + public: + + employee(int id,string n) + { + eid=id; + name=n; + } + + int getid() + { + return eid; + } + + string getname() + { + return name; + } +}; + +class fulltimeemployee: public employee +{ + private: + int salary; + + public: + fulltimeemployee(int id,string n,int sal):employee(id,n) + { + salary=sal; + } + + int getsalary() + { + return salary; + } +}; + +class parttimeemployee: public employee +{ + private: + int wages; + + public: + parttimeemployee(int id,string n,int w): employee(id,n) + { + wages=w; + } + + int getwages() + { + return wages; + } +}; + +int main() +{ + fulltimeemployee p1(1,"umesh",100000); + parttimeemployee p2(2,"Navya",100000); + + + cout<<"Salary of"<