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
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
The concepts of composition and aggregation in object-oriented programming (oop) through lecture notes. It covers the use of string and student classes, constructor and destructor implementations, and the differences between composition and aggregation. The document also includes examples of room and chair classes, and friend functions.
Typology: Slides
1 / 34
**String()SetString(char ) : voidGetString() const : const char ~String()…
gpa : floatrollNo : intname : StringStudent(char * = NULL, int = 0,
float = 0.0);
**Student(const Student &)GetName() const : StringGetNamePtr() const : const char SetName(char ) : void~Student()…
Student
**string : char ***
String
Student::Student(char * n,
int
roll, float g){
cout <<"Constructor::
Student..\n";
name.SetString(n);rollNumber = roll;gpa = g; }
►Add an overloaded constructor to the String
class defined above:
char
*ptr; public:
String
void
SetName(char
//String(char * = NULL);
String name: char
String()String(char )~String()… …Date()Date(int,int,int)*
**…name : StringbirthDate : DateStudent()Student( char *,const Date &, int, float)SetName(char ) : voidGetName() : char ~Student()…
Student
day: intMonth: intyear: int
Date
class
Student{ private: … Date
birthDate; String
name; public: Student(char
const
Date
int,
float);
~Student();…
int main(){ Date _date(31, 12, 1982);Student aStudent("Fakhir",
_date,899,3.5);
return 0;
Room{ private: float
area; Chair
chairs[50];
Public: Room();void
AddChair(Chair
int
chairNo);
Chair
GetChair(int
chairNo);
bool
FoldChair(int
chairNo);