C#. What are the fundamental OOP concepts?Ask a question
Ans: The four fundamental concepts of Object Oriented Programming are:
Encapsulation – The Internal representation of an object is hidden from the view outside object’s definition. Only the required information can be accessed whereas the rest of the data implementation is hidden.
Abstraction – It is a process of identifying the critical behavior and data of an object and eliminating the irrelevant details.
Inheritance – It is the ability to create new classes from another class. It is done by accessing, modifying and extending the behavior of objects in the parent class.
Polymorphism – The name means, one name, many forms. It is achieved by having multiple methods with the same name but different implementations.
There are four fundamental concepts of OOP(Object Oriented Programming). These are Abstraction, Polymorphism, Inheritance, Encapsulation. In short you can remember it as “A-PIE”.
Abstraction- The process of identifying only the required characteristics of an object by ignoring the irrelevant details. In java abstraction is achieved by interfaces and abstract classes.
Polymorphism- Polymorphism is an object oriented programming feature that allows us to perform a single action in different ways. There are two type of polymerphism i.e method overloading and method overriding.
Inheritance- It is the mechanism in java by which one class is allow to inherit the features(fields and methods) of another class. It is helpful to reuse the functionality in java.
Encapsulation- It is defined as the wrapping up of data under a single unit. Encapsulation simply means binding object state(fields) and behavior(methods) together. If you are creating class means you are doing encapsulation.