Uploaded by Husnain Tassaduq

Assignment # 3 ooop

advertisement
Department Of Software Engineering
University of Lahore
Instructors:
Salman Shamshad
Object Oriented Programing
Summer 2022
Assignment # 3
Date: 18/08/2022
Due Date: 21/08/2022
Objective
Objective of this assignment is to make understand and implement the concept of inheritance in
C++.
Activities
Students are expected to study about inheritance and use of constructors in inheritance.
Students will practice programs related about these topics on compiler.
Students can extend their study by referring the books present in Library on “Object Oriented
Programing”.
Submission Format
Submit on Moodle. PDF or MSWord format.
Problem:
Write a Person class that has attributes of id, name and address. It has a constructor to initialize, a
member function to input and a member function to display data members.
Create second class Student that inherits Person class. It has additional data members of roll
number and marks. It also has member functions to input and display its data members.
Create another class Scholarship that inherits Students class. It has additional attributes of
scholarship name and amount. It also has member functions to input and display its data members.
Each drive class must override the input and display member functions.
Make the display function as const.
Drive each subclass privately. Create three objects of Scholarship class and call all the member
functions of the Scholarship class. Then take a snapshot of the result. If a function is not accessible
then explain in your own words why it is not accessible.
Summer 2022
Assignment#3
Object Oriented Programing
Drive each subclass protectedly. Create three objects of Scholarship class and call all the member
functions of the Scholarship class. Then take a snapshot of the result. If a function is not accessible
then explain in your own words why it is not accessible.
Drive each subclass publically. Create three objects of Scholarship class and call all the member
functions of the Scholarship class. Then take a snapshot of the result. If a function is not accessible
then explain in your own words why it is not accessible.
Deadline
Submission Date: Sunday 21 Aug, 2022
Time: 11:55 PM
Violation of Deadline means
zero marks
Summer 2022
Assignment#3
Object Oriented Programing
Download