BCA / B.Tech 7 min read

Aggregation & Encapsulation

Aggregation & Encapsulation in RDBMS:

Aggregation is a data modeling concept that represents a "has-a" or "part-of" relationship between entities. It is used when one class is made up of other classes. For example, a `Car` object is an aggregation of `Engine`, `Wheel`, and `Chassis` objects. The parts can exist independently of the whole. For instance, an `Engine` can exist even if the `Car` is destroyed.

Encapsulation is a core principle of object-oriented programming. It involves bundling the data (attributes) and methods (functions that operate on the data) that work on that data within a single unit, or "class." It restricts direct access to some of an object's components, which is a way to prevent accidental interference and misuse of the data. Access to the data is typically controlled through public methods (getters and setters).