Spring 2023 - CS304 - 1
Spring 2023 - CS304 - 1
Object Oriented
Programming (CS304) May 20th
Assignment # 01 , 2023
Spring 2023
Please carefully read the following instructions before attempting the assignment.
You should consult the recommended books to clarify your concepts as handouts are not
sufficient.
Topic Covered:
● Lecture 01-09
Uploading instructions:
● Your assignment should be in .CPP format (Any other formats like scan images, PDF, zip,
doc, rar and bmp etc. will not be accepted).
● Save your assignment with your ID (e.g. bc000000000.CPP).
● No assignment will be accepted through email.
NOTE
No assignment will be accepted after the due date via email in any case (whether it is the case of
load shedding or internet malfunctioning etc.). Hence refrain from uploading assignments in
the last hour of the deadline. It is recommended to upload the solution file at least two days
before its closing date.
If you find any mistake or confusion in the assignment (Question statement), please consult
with your instructor before the deadline. After the deadline, no queries will be entertained in
this regard.
Suppose a university wants to keep track of its students' information, such as their name, age, and student ID,
for various purposes such as enrollment, attendance, and grading. The university could create a Student class
that includes these member variables to represent each student, and use the class to store and manipulate the
information of each student.
Considering the given scenario create a C++ program with Student class that includes three member variables:
name, age, and studentId, and provides a default constructor, a parameterized constructor, a copy constructor
that performs a shallow copy, and an assignment operator that performs a deep copy. The main function
creates three Student objects using different constructors, and demonstrates the differences between shallow
and deep copying by modifying one object's name and printing the values of all three objects. The Student class
could be used in a real-life scenario such as a university keeping track of students' information for enrollment,
attendance, and grading purposes.
- Default constructor
- Parameterized constructor
- Copy constructor (shallow copy)
- Assignment operator (deep copy)
- Getter method for name
Methods - Getter method for age
- Getter method for studentId
- Setter method for name
- Setter method for age
- Setter method for studentId
- Print method to display student info
Note: Student will use their own name and Student ID as an input.
Best of Luck