Lab 6
Lab 6
Lab 6
#include<iostream>
class Employee
int EmployeeId;
long Scale;
public:
Employee()
Employee(int x, long y)
this->EmployeeId = x;
this->Scale = y;
}
void GetData()
cin>>EmployeeId;
cin>>Scale;
void PutData()
cout<<"\n\nEmployee Id : "<<this->EmployeeId;
};
int managerId;
string department;
public:
void GetData()
cin>>managerId;
cin>>department;
void PutData()
cout<<"\nManager Id : "<<managerId;
};
int main()
{
Manager m(1,25000);
m.GetData();
m.Employee::PutData();
m.PutData();
return 0;
Task 2\
#include<iostream>
class student{
protected:
int admission_no;
string name;
int age;
string addresss;
string depattment;
public:
set_students()
get_data(){
};
protected:
string depatment;
public:
void setdata(){
get_data()
cout<<"**undergrad***"<<endl;
};
class drived: public student {
protected:
string depatment;
public :
void setdata(){
cin >>depatment ;}
get_data()
cout<<"***graduate***"<<endl;
};
student s,s1;
drived1 g;
drived u;
char press;
cout<<"press "<<endl;
cin>>press;
if(press=='x'){
g.setdata();
g.get_data();
s.set_students();
s. get_data();
u.setdata();
u.get_data();
s1.set_students();
s1. get_data();
}
Task 3
#include <iostream>
class Mammals {
public:
void Function_1() {
};
public:
void Function_2() {
};
public:
void Function_3() {
cout << "I belong to both the categories: Mammals as well as Marine Animals.\n" ;}
};
int main() {
Mammals m1;
MarineAnimals ma1;
BlueWhale bw1;
m1.Function_1();
ma1.Function_2();
bw1.Function_3();
// Calling parent class functions
bw1.Function_1();
bw1.Function_2();
return 0;