محاضرة 5
Object-Oriented Programming (OOP)
مبادئ OOP: Encapsulation، Inheritance، Polymorphism، Abstraction.
يلا نشوف الملخص
📖 Lecture 5: Object-Oriented Programming (OOP)
- OOP Concepts: Designing software based on real-world objects that contain data (attributes) and behaviors (methods) [18].
- Encapsulation: Hiding data by making variables
privateand providing access throughpublicgetter and setter methods. This protects the internal state of the object [21, 22]. - Inheritance: Allows a class (Subclass) to inherit properties and methods from another class (Superclass) using the
extendskeyword. It promotes code reusability [23]. - Polymorphism: The ability to take multiple forms [18].
- Compile-time Polymorphism: Achieved via Method Overloading [21].
- Run-time Polymorphism: Achieved via Method Overriding (a subclass providing a specific implementation of a superclass method) [22].
- Abstraction: Hiding complex implementation details and showing only essential features [24]. Achieved via Abstract Classes (which cannot be instantiated) or Interfaces [24]. An abstract class can have constructors, but a class can only extend one abstract class (while it can implement multiple interfaces) [25].
في نقطة مش واضحة؟ بطبط موجود!
اسأل بطبط عنها