



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
OOP stands for Object-Oriented Programming. Procedural programming is about writing procedures or functions that perform operations on the data, while object-oriented programming is about creating objects that contain both data and functions.
Typology: Lab Reports
1 / 7
This page cannot be seen from the preview
Don't miss anything!




CODE: #include
if (GPA < 0 || GPA>4) { cout << "\t\t\t\t => Invalid GPA!" << endl; cout << "\t\t\t\t=> Enter student's GPA: "; cin >> GPA; } } //Polymorphic Function void print() { cout << "\t\t\t=> Student's Name: " << name << endl; cout << "\t\t\t=> Student's GPA: " << GPA << endl; } }; class Professor : public person { protected: int NumPubl; public: Professor() { NumPubl = 0; } ~Professor() { cout << "\n\n\t\t\t\t => Destructor of class Professor was called!" << endl; } //Polymorphic Function void getData() { getName(); cout << "\t\t\t\t=> Enter number of professor's publications: "; cin >> NumPubl; } //Polymorphic Function void print() { cout << "\t\t\t=> Professor's Name: " << name << endl; cout << "\t\t\t=> Professor's Number of Publication: "<<NumPubl <<endl; } }; void main() { int p; person* personPtr[50]; int n_s, n_p;//n_p=Number of students, n_s=number of Professor cout << "\t\t
t------------------------------------------------------------------"; cout << "\n\t\t\t| |"; cout << "\n\t\t\t| Lab 12 |"; cout << "\n\t\t\t| |"; cout << "\n\t\t
t------------------------------------------------------------------\n\n\n"; cout << "\n\t\t\t\tEnter the number of students you want to input: "; cin >> n_s;