


























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
Aggregation, Composition, Composition and Aggregation, Pointer to an object, Reference to an object, Friend Functions, Global function, Prototypes of friend functions are points you can learn in this Object Oriented Programming lecture.
Typology: Slides
1 / 34
This page cannot be seen from the preview
Don't miss anything!



























*String() SetString(char ) : void GetString() const : const char * ~String() …
*gpa : float rollNo : int name : String Student(char * = NULL, int = 0, float = 0.0); Student(const Student &) GetName() const : String GetNamePtr() 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;
}
String class defined above:
char *ptr; public: String();
String(const String &); void SetName(char *); ~String();
//String(char * = NULL);
*String name: char * String() String(char ) ~String() …
… Date() Date(int,int,int) Date(const Date &) …
**Student() Student( char , const Date &, int, float) SetName(char ) : void GetName() : char * ~Student() …
… name : String birthDate : Date
Student
day: int Month: int year: int
Date
follows:
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;
}
class Room{
private:
float area; Chair * chairs[50];
Public:
Room();
void AddChair(Chair *, int chairNo);
Chair * GetChair(int chairNo); bool FoldChair(int chairNo);
…
};