Encapsulation and Abstraction
Encapsulation: Binding the data and methods that operate on the data within a single unit.
Abstraction: Hiding the complexity and providing a simple interface to the user.
Classes and Objects
A class is a blueprint that defines a set of properties (attributes) and methods (functions)
that operate on those properties.
An object is an instance of a class.
Polymorphism
Polymorphism allows objects of different classes to be treated as objects of a common
superclass.
This leads to a more flexible and reusable code.
Problems with Structural Programming
Global data can be accessed from anywhere in the program, leading to unintended
modifications and difficult-to-find bugs.
Data coupling can occur when two or more parts of a program rely on the internal structure
of the data they operate on, making the code brittle and difficult to modify.
Features of Object Oriented Programming
Encapsulation: Binding data and methods together to form a single unit.
Abstraction: Hiding complexity and providing a simple interface.
Polymorphism: Allowing objects of different classes to be treated as objects of a common
superclass.
Inheritance: Allowing a class to inherit properties and methods from another class, leading
to reusable and modular code.
Inheritance and Reusability
Inheritance allows a class to inherit properties and methods from another class.
This promotes reusability of code by allowing existing code to be extended and modified.
It also leads to more modular and maintainable code by reducing duplication and providing a
clear hierarchy of classes.