From dcda5101876b858a651c6a62e6833f332fdac79b Mon Sep 17 00:00:00 2001 From: Umesh <99874481+Umeshch2004@users.noreply.github.com> Date: Sun, 15 Oct 2023 22:34:13 +0530 Subject: [PATCH] Create Inheritance CPP --- Inheritance CPP | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Inheritance CPP 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"<