0% found this document useful (0 votes)
3 views3 pages

Assignment 1

This document outlines an assignment for students on Object Oriented Programming, focusing on the concepts of encapsulation, data abstraction, and class relationships. Students are tasked with creating two classes, Person and Student, and implementing various methods including constructors, getters, setters, and destructors. The assignment is due on August 22, 2020, before 12 am.

Uploaded by

Ahmad Raza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Assignment 1

This document outlines an assignment for students on Object Oriented Programming, focusing on the concepts of encapsulation, data abstraction, and class relationships. Students are tasked with creating two classes, Person and Student, and implementing various methods including constructors, getters, setters, and destructors. The assignment is due on August 22, 2020, before 12 am.

Uploaded by

Ahmad Raza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment 2

Object Oriented Programming Nabeel Sabir khan

I hope you all are fine and at home.

D ear students, so far we have learnt following object oriented concepts: 1


 Encapsulation
 Data Abstraction
 Access specifiers
 Member functions
o Getters & Setters
o Constructors
o Copy Constructors
o Destructors
 Object manipulation

Until now, we have implemented above mentioned concepts, only on a single class. It’s
about time that we shall learn how to operate multiple classes, on basis of the above
mentioned concepts.

When we consider a model, based upon multiple classes, there is a fair possibility that our
concerned class might have some sort of relationship with each other. In your next lecture
we’ll discuss, how we can identify different relationships amongst two or more classes and
then implement that relationship in our C++ code.

Before you come to your next class, you shall have a little know how about multiple classes’
manipulation. To serve that purpose, I am assigning you a pre lecture assignment. As always
we’ll persist with our usual case study, which is “student class object”. So far we have worked
upon following student class attributes:

Student attributes:

 Name
 Age
 CGPA
 Roll number

If you ponder a little and compare this instance with your common life, you will be able to
understand that “Name and Age” are not specifically a student’s attributes but a person’s.

Every person has a name and an age, but every person doesn’t have a CGPA or a roll number,
which specifically are student class’s objects.

As mentioned before, it’s about time that we shall learn how to differentiate amongst two
different classes, to begin let us differentiate our person class attributes from the above
mentioned student class.
Assignment 2
Object Oriented Programming Nabeel Sabir khan

As per differentiation, following is our new class model:


2
PERSON CLASS STUDENT CLASS
Name : char* CGPA : double
Age : int Roll no. : char*

This is where your assignment begins, you’ve all learnt how to manipulate a single class
from main function, this time you’ll have to perform the same task (i.e. maintain same
attributes as you did previously in your student class) but we will be making use of two
classes rather than one.

You are supposed to:

 Create two different classes


o Student class
o Person class
 Write separate following methods for both classes:
o Constructors (default parameterized)
o Getters & Setters
o Copy constructors
o Destructors
o Display
 Make full use of dynamic memory allocation in both classes
 Create both objects in man function using either constructors or setter functions
(which ever you feel comfortable with).

Following is a sample main program for this particular problem:


Assignment 2
Object Oriented Programming Nabeel Sabir khan

3
Following is the final state of this program:

DEADLINE: As you people have already implemented this case study for more than
a couple of times now, I assume after a little modification you’ll be able to code this
problem within no time.

Thus the submission deadline for this assignment is:


22nd August, 2020 before 12 am.

You might also like