


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A lab task on Object-Oriented Programming. It provides instructions on how to create a class with data members and member functions, inherit from multiple classes, and write a test program to demonstrate the classes' capabilities. sample code written in C++.
Typology: Lab Reports
1 / 4
This page cannot be seen from the preview
Don't miss anything!



Lab Task 6.1: Create a class personalDetails which has three data members name, gender and address. This class has a member function getPersonalDetails to get these details from user. Create a new class deptDetails which has also three data members deptName, Id and assignedTask. This class has a member function getDeptDetails to get these details from the user. Now inherit a new class employee from both these classes. This class has a member function print to display all these details. Write a test program that demonstrates all these classes’ capabilities. #include
cout<<"Gender: "<<Gender<<":"<<endl; cout<<"Addresst: "<<Address<<":"<<endl; cout<<"Department Name: "<<Dept_Name<<":"<<endl; cout<<"ID: "<<ID<<":"<<endl; cout<<"Assigned Task: "<<Assigned_Task<<":"<<endl; } }; int main() { system("color F0"); Employee E; E.get_personalDetails(); E.get_dept_details(); E.print(); return 0; }
system("color F0"); Square sqr; Cube cub; sqr.get_number(); sqr.square_of_number(); cout<<endl; cub.cube_of_number(); return 0; }