Posts

Showing posts from October, 2023

Object-oriented Programming

Object-oriented programming (OOP) is a programming paradigm that organizes data and behavior into reusable structures called objects. Each object contains data (often attributes or properties) and methods (functions that operate on the object’s data).   Object-oriented programming has four major principles which are, Encapsulation, Inheritance, Abstraction and Polymorphism.    Encapsulation   Encapsulation refers to combining data (attributes) and methods (functions) that operate on the data into a single unit called a class. This mechanism helps conceal the object's internal state from the outside world and enables access to data through public methods, such as getters and setters. In other words, encapsulation provides a way to keep data and methods safe and secure within the class and only allows controlled access.   Features   Data Hiding:  The data within an object is hidden and can only be accessed and modified through its public methods, ensurin...