-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexp18b.cpp
More file actions
41 lines (37 loc) · 811 Bytes
/
exp18b.cpp
File metadata and controls
41 lines (37 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<iostream>
using namespace std;
class Staff{
protected:
int id;
string Name;
public:
Staff(int id , string Name){
this->id = id;
this->Name = Name;
}
};
class Salary{
protected:
float Salary_staff;
public:
Salary(float amt){
this->Salary_staff = amt;
}
} ;
class Faculty : public Staff , public Salary {
string Department;
public:
Faculty(int id , string name , float salary , string Dep) : Staff(id , name) , Salary(salary) {
this->Department = Dep;
cout<<"Constructor called !!"<<endl;
}
void display(){
cout<<id<<" "<<Name<<endl;
cout<<"Department Name :"<<Department<<endl;
cout<<"Salary :"<<Salary_staff<<endl;
}
};
int main(){
Faculty Kunal(101,"Kunal_Bansal" , 100000 , "CSE");
Kunal.display();
}