WHAT IS THE MODULARITY IN OOP? AND WHAT IS HIERARCHY? AND WHATS THE DIFFERENCE BETWEEN BOTH AND INHERITANCE?

First, don't use all caps. It is harder to read and online it is like SHOUTING.

Since this is not my area of expertise, I searched Google under the key words "OOP" to get this:

http://www.google.com/search?client=safari&rls=en&q=OOP&ie=UTF-8&oe=UTF-8

In the future, you can find the information you desire more quickly, if you use appropriate key words to do your own search. Also see http://hanlib.sou.edu/searchtools/.

In object-oriented programming (OOP), modularity and hierarchy are both important concepts that help in organizing and structuring code. However, they are different concepts with distinct meanings.

Modularity refers to the practice of breaking down a complex system or program into smaller, self-contained modules or components. Each module handles a specific task or functionality, can be developed independently, and can be easily combined with other modules to create a larger system. Modularity promotes code reusability, maintainability, and readability.

To achieve modularity in OOP, you can use techniques like encapsulation, which hides the internal details of a module, and abstraction, which exposes only the relevant information and behavior. Creating classes and objects is a common way to implement modularity in OOP.

Hierarchy, on the other hand, refers to the organization of elements in a structured manner, typically in a hierarchical tree-like structure. In OOP, hierarchy is mainly used for creating class relationships and establishing a parent-child or superclass-subclass relationship.

In OOP, inheritance is a mechanism used to establish a hierarchical relationship between classes. It allows a derived (child) class to inherit the properties, methods, and behaviors of a base (parent) class. The derived class can then extend, modify, or override the inherited attributes, while also adding its own unique features.

Inheritance is a way to establish a hierarchical relationship, whereas hierarchy is a broader concept that can be applied to various aspects, including the organization of classes, functions, modules, or even the organization of larger systems.

To summarize:
- Modularity is the practice of breaking down a complex system into smaller, self-contained modules or components.
- Hierarchy is the organization of elements, such as classes, in a structured and hierarchical manner.
- Inheritance is a mechanism used in OOP to establish a hierarchical relationship between classes, where a derived class inherits properties and behaviors from a base class.