├── Assignments ├── Assignment#2_Spring2025_v2.pdf ├── Assignment#3_Spring2025.pdf └── OOP Assignment 1[C++]v1.0.docx.pdf ├── Books ├── Problem_Solving_with_C++__9th_Savitch_.pdf ├── c++ the complete reference, 4th edition - herbert schildt.pdf └── deitel c++ how to program, 7th edition 2010_pre_co_prj.2714.733_.pdf ├── Class Activity ├── Class Activity _1.pdf └── sample ├── Codes ├── Abstract Class.txt ├── Composition.txt ├── Composition2.txt ├── Filing - Objects Read and Write.txt ├── Filing-SeekpSeekg.txt └── Week 2.txt ├── Course Description - Object-oriented Programming (CS-1004) 2025.pdf ├── Daily Tasks ├── Lecture Slides ├── Association.pdf ├── Constant and static (1).pdf ├── Exception Handling (1).pdf ├── Filing.pdf ├── Friend.pdf ├── Generics.pdf ├── Inheritance.pdf ├── Introduction To OOP.pdf ├── OOP Getter_Setter and Constructors.pdf ├── Operator Overloading.pdf └── Polymorphism.pdf ├── Past Paper ├── 2025 │ ├── Mid 2 solution.pdf │ ├── OOP Spring 25 Final_Solution.docx.pdf │ └── OOP_Mid2_Spring 25 Final.docx ├── CS1004-C++-ObjectOrientedProgramming-Mid-I-v3 [moderated].pdf ├── Finals │ ├── CS1004-C++-ObjectOrientedProgramming-Final Exam_v2.pdf │ ├── Final OOP_2023 v6.0 [C++] - Solution.pdf │ └── sample ├── Mid 1 OOP_2023 v4.0 [Moderated].pdf ├── OOPmid1_solution.docx ├── Object Oriented Programming Solution.pdf ├── Re-Mid 1 OOP_2023 v3.0.docx └── sample └── README.md /Assignments/Assignment#2_Spring2025_v2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Assignments/Assignment#2_Spring2025_v2.pdf -------------------------------------------------------------------------------- /Assignments/Assignment#3_Spring2025.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Assignments/Assignment#3_Spring2025.pdf -------------------------------------------------------------------------------- /Assignments/OOP Assignment 1[C++]v1.0.docx.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Assignments/OOP Assignment 1[C++]v1.0.docx.pdf -------------------------------------------------------------------------------- /Books/Problem_Solving_with_C++__9th_Savitch_.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Books/Problem_Solving_with_C++__9th_Savitch_.pdf -------------------------------------------------------------------------------- /Books/c++ the complete reference, 4th edition - herbert schildt.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Books/c++ the complete reference, 4th edition - herbert schildt.pdf -------------------------------------------------------------------------------- /Books/deitel c++ how to program, 7th edition 2010_pre_co_prj.2714.733_.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Books/deitel c++ how to program, 7th edition 2010_pre_co_prj.2714.733_.pdf -------------------------------------------------------------------------------- /Class Activity/Class Activity _1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Class Activity/Class Activity _1.pdf -------------------------------------------------------------------------------- /Class Activity/sample: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Codes/Abstract Class.txt: -------------------------------------------------------------------------------- 1 | Create an abstract base class called Product with the following data members: id (an integer), name (a string), price (a double), and description (a string). Declare a virtual function called printDetails() that will print the product details. 2 | Create three subclasses of Product: ElectronicProduct, BookProduct, and ClothingProduct. Each subclass should have additional data members unique to that type of product. For example, ElectronicProduct could have a manufacturer (a string) and a warrantyPeriod (an integer), BookProduct could have an author (a string) and a publisher (a string), and ClothingProduct could have a size (a string) and a material (a string). 3 | 4 | Each subclass should also override the printDetails() function to print the product details along with the unique properties. 5 | 6 | Create an array of Product objects and initialize them with different types of products. Use a loop to call the printDetails() function for each object, which should print the product details along with the unique properties specific to that type of product. 7 | 8 | Help: 9 | ElectronicProduct e(1, "Laptop", 999.99, "High-performance laptop", "Dell", 2); 10 | BookProduct b(2, "The Great Gatsby", 12.99, "Classic American novel", "F. Scott Fitzgerald", 11 | "Scribner"); 12 | ClothingProduct c(3, "Men's T-shirt", 19.99, "Comfortable cotton t-shirt", "M", "Cotton"); 13 | Product* products[] = {&e, &b, &c}; 14 | 15 | 16 | 17 | 18 | // Online C++ compiler to run C++ program online 19 | #include 20 | using namespace std; 21 | class Base { 22 | protected: 23 | int a; 24 | public: 25 | //virtual void setA(int) = 0; 26 | Base() { 27 | a = 0; 28 | } 29 | Base(int i) { 30 | a = i; 31 | } 32 | int getA(){ 33 | return a; 34 | } 35 | virtual void func() = 0; 36 | virtual ~Base() { 37 | cout << "Destroyed Base\n"; 38 | } 39 | }; 40 | 41 | class Derived : public Base{ 42 | public: 43 | Derived() : Base() {} 44 | Derived(int i) : Base(i) {} 45 | void func() override { 46 | cout << "Overriden in Derived class : " << getA() << endl; 47 | } 48 | ~Derived() { 49 | cout << "Destroyed Derived\n"; 50 | } 51 | }; 52 | 53 | int main() { 54 | //Base obj; 55 | Base *ptr; 56 | //ptr = new Base(10); 57 | ptr = new Derived(); 58 | ptr->func(); 59 | Derived obj(10); 60 | obj.func(); 61 | delete ptr; 62 | return 0; 63 | } -------------------------------------------------------------------------------- /Codes/Composition.txt: -------------------------------------------------------------------------------- 1 | // Online C++ compiler to run C++ program online 2 | #include 3 | #include 4 | using namespace std; 5 | class Employee 6 | { 7 | private: 8 | int id; string name; 9 | public: 10 | Employee(int id, string name) 11 | { 12 | this->id = id; 13 | this->name = name; 14 | cout<<"employee parameterized created"<id = id; 24 | this->name = name; 25 | } 26 | }; 27 | class Department { 28 | private: 29 | string name; Employee HoD; int numEmployees; int maxEmployees; Employee employees[5]; 30 | public: 31 | 32 | Department(string name, string managerName, int managerID, int maxEmployees) 33 | : name(name), HoD( managerID,managerName), numEmployees(0), maxEmployees(maxEmployees) {} 34 | void Display() 35 | { 36 | cout<<"Department Name "< 2 | #include 3 | using namespace std; 4 | class Employee 5 | { 6 | private: 7 | int id; string name; 8 | public: 9 | Employee(int id, string name) 10 | { 11 | this->id = id; 12 | this->name = name; 13 | cout<<"employee parameterized created"<id = id; 23 | this->name = name; 24 | } 25 | }; 26 | class Department { 27 | private: 28 | string name; Employee HoD; int numEmployees; int maxEmployees; Employee *employees; 29 | public: 30 | 31 | Department(string name, string managerName, int managerID, int maxEmployees) 32 | : name(name), HoD( managerID,managerName), numEmployees(0), maxEmployees(maxEmployees) { 33 | employees= new Employee[maxEmployees]; 34 | } 35 | void Display() 36 | { 37 | cout<<"Department Name "< 2 | #include 3 | using namespace std; 4 | class student{ 5 | int roll; 6 | char name[25]; 7 | float marks; 8 | public: 9 | void getdata(){ 10 | cout << "enter roll no" << endl; 11 | cin >> roll; 12 | cout << "enter name" << endl; 13 | cin >> name; 14 | cout << "enter marks" << endl; 15 | cin >> marks;} 16 | void displayStudent(){ 17 | cout<<"Roll no: "<> c; 50 | } while (c == 'y' || c == 'Y'); 51 | cout << "data written successfully"; 52 | s.Readdata(); 53 | } -------------------------------------------------------------------------------- /Codes/Filing-SeekpSeekg.txt: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | struct Student { 7 | int id; 8 | string name; 9 | float GPA; 10 | }; 11 | 12 | int main() { 13 | ofstream outfile("students.dat", ios::out | ios::binary); 14 | if (!outfile) { 15 | cerr << "Failed to open file for writing!" << endl; 16 | return 1; 17 | } 18 | 19 | Student s1 = {1, "John", 3.8}; 20 | outfile.write((char*)&s1, sizeof(Student)); 21 | Student s2 = {1, "Ali", 3.5}; 22 | outfile.write((char*)&s2, sizeof(Student)); 23 | outfile.close(); 24 | 25 | fstream file("students.dat", ios::in | ios::out | ios::binary); 26 | if (!file) { 27 | cerr << "Failed to open file for updating!" << endl; 28 | return 1; 29 | } 30 | file.seekg(0); 31 | Student s_read; 32 | file.read((char*)&s_read, sizeof(Student)); 33 | cout << "Initial Student Data: ID-" << s_read.id << ", Name-" << s_read.name << ", GPA-" << s_read.GPA << endl; 34 | file.read((char*)&s_read, sizeof(Student)); 35 | cout << "Initial Student Data: ID-" << s_read.id << ", Name-" << s_read.name << ", GPA-" << s_read.GPA << endl; 36 | cout< 2 | #include 3 | using namespace std; 4 | 5 | class Dr { 6 | private: 7 | string name; 8 | int age; 9 | int experience; 10 | int patientCount; 11 | string patients_name[10]; 12 | string qualification; 13 | public: 14 | Dr(string n, string spec, int exp) { 15 | name = n; 16 | experience = exp; 17 | patientCount = 0; 18 | } 19 | void setName(string n) { name = n; } 20 | void setQualification(string spec) { qualification = spec; } 21 | 22 | string getName() { return name; } 23 | int getExperience() { return experience; } 24 | 25 | void assignPatient(string patientName) { 26 | if (patientCount < 10) { 27 | patients_name[patientCount] = patientName; 28 | patientCount++; 29 | cout << "Patient " << patientName << " assigned to Dr. " << name << endl; 30 | } else { 31 | cout << "Cannot assign more patients. Maximum limit reached." << endl; 32 | } 33 | } 34 | 35 | void displayInfo() { 36 | cout << "Dr. " << name << ", " << experience << " years experience)" << endl; 37 | } 38 | int calculateSalary() { 39 | if (qualification == "MBBS") { 40 | return 100000;} 41 | else if (qualification == "FCPS1") { 42 | return 200000; } 43 | else if (qualification == "FCPS2") { 44 | return 400000; } 45 | } 46 | }; 47 | 48 | int main() { 49 | 50 | Dr doctor1("Strange", "Cardiologist", 15); 51 | doctor1.displayInfo(); 52 | 53 | doctor1.assignPatient("Ali"); 54 | doctor1.assignPatient("Sumaiyah"); 55 | 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /Course Description - Object-oriented Programming (CS-1004) 2025.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Course Description - Object-oriented Programming (CS-1004) 2025.pdf -------------------------------------------------------------------------------- /Daily Tasks: -------------------------------------------------------------------------------- 1 | https://docs.google.com/document/d/1rMpyU76uTpYSt04I8CfKPePRKy8z-MiHhdwBjJ4vySU/edit?usp=sharing 2 | -------------------------------------------------------------------------------- /Lecture Slides/Association.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Lecture Slides/Association.pdf -------------------------------------------------------------------------------- /Lecture Slides/Constant and static (1).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Lecture Slides/Constant and static (1).pdf -------------------------------------------------------------------------------- /Lecture Slides/Exception Handling (1).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Lecture Slides/Exception Handling (1).pdf -------------------------------------------------------------------------------- /Lecture Slides/Filing.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Lecture Slides/Filing.pdf -------------------------------------------------------------------------------- /Lecture Slides/Friend.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Lecture Slides/Friend.pdf -------------------------------------------------------------------------------- /Lecture Slides/Generics.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Lecture Slides/Generics.pdf -------------------------------------------------------------------------------- /Lecture Slides/Inheritance.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Lecture Slides/Inheritance.pdf -------------------------------------------------------------------------------- /Lecture Slides/Introduction To OOP.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Lecture Slides/Introduction To OOP.pdf -------------------------------------------------------------------------------- /Lecture Slides/OOP Getter_Setter and Constructors.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Lecture Slides/OOP Getter_Setter and Constructors.pdf -------------------------------------------------------------------------------- /Lecture Slides/Operator Overloading.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Lecture Slides/Operator Overloading.pdf -------------------------------------------------------------------------------- /Lecture Slides/Polymorphism.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Lecture Slides/Polymorphism.pdf -------------------------------------------------------------------------------- /Past Paper/2025/Mid 2 solution.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Past Paper/2025/Mid 2 solution.pdf -------------------------------------------------------------------------------- /Past Paper/2025/OOP Spring 25 Final_Solution.docx.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Past Paper/2025/OOP Spring 25 Final_Solution.docx.pdf -------------------------------------------------------------------------------- /Past Paper/2025/OOP_Mid2_Spring 25 Final.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Past Paper/2025/OOP_Mid2_Spring 25 Final.docx -------------------------------------------------------------------------------- /Past Paper/CS1004-C++-ObjectOrientedProgramming-Mid-I-v3 [moderated].pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Past Paper/CS1004-C++-ObjectOrientedProgramming-Mid-I-v3 [moderated].pdf -------------------------------------------------------------------------------- /Past Paper/Finals/CS1004-C++-ObjectOrientedProgramming-Final Exam_v2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Past Paper/Finals/CS1004-C++-ObjectOrientedProgramming-Final Exam_v2.pdf -------------------------------------------------------------------------------- /Past Paper/Finals/Final OOP_2023 v6.0 [C++] - Solution.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Past Paper/Finals/Final OOP_2023 v6.0 [C++] - Solution.pdf -------------------------------------------------------------------------------- /Past Paper/Finals/sample: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Past Paper/Mid 1 OOP_2023 v4.0 [Moderated].pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Past Paper/Mid 1 OOP_2023 v4.0 [Moderated].pdf -------------------------------------------------------------------------------- /Past Paper/OOPmid1_solution.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Past Paper/OOPmid1_solution.docx -------------------------------------------------------------------------------- /Past Paper/Object Oriented Programming Solution.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Past Paper/Object Oriented Programming Solution.pdf -------------------------------------------------------------------------------- /Past Paper/Re-Mid 1 OOP_2023 v3.0.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SumaiyahZahid/Object-Oriented-Programming/474beab9a298f85c54c3d1f4dffa9115995392af/Past Paper/Re-Mid 1 OOP_2023 v3.0.docx -------------------------------------------------------------------------------- /Past Paper/sample: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Welcome to CS1004 Object Oriented Programming! 3 | Hey there, curious coder! 4 | 5 | This repo is here to guide you, challenge you, and make sure you have FUN along the way! 6 | It has all the resource material you will need for **Spring 2025 CS1004 Object Oriented Programming Course**. 7 | 8 | ## 🛠 **How to Use This Repo** 9 | 1. **Clone it**: `git clone https://github.com/SumaiyahZahid/Object-Oriented-Programming.git` 10 | 2. **Explore**: Navigate through the folders, open the files, and take your learning journey at your own pace. 11 | 3. **Contribute**: Got some awesome examples or extra resources to share? Feel free to submit a pull request. We’re all in this learning adventure together! 12 | 13 | ## 🤝 **Community & Support** 14 | Learning is better together! If you have any questions, feel free to: 15 | - **Drop an Email** at sumaiyah@nu.edu.pk 16 | - **Reach out in class** 17 | - **Reach out on Discord** https://discord.gg/85wvSrPAfg 18 | 19 | Enjoy your coding journey and remember: **The best way to learn is by doing**! 20 | 21 | Happy coding, and may the bugs be ever in your favor! 🐞 22 | --------------------------------------------------------------------------------