Introduction To OOP(object Oriented Programming) Concept Step By Step PDF.Top Reseached Based OOP interview Questions.OOP(object Oriented Programming) Principles. how to Implement OOP in Lanaguages
What Is OOP(Object oriented Programming)
- OOP was introduced to overcome flaws in the procedural approach to programming.
- Such as lack of re usability & maintainability.
- Fundamental idea behind object‐oriented languages is to combine into a single unit both data and the functions that operate on that data.
- Such a unit is called an object.
Why Do We Need Object‐Oriented Programming.
- Object‐Oriented Programming was developed because limitations were discovered in earlier approaches to programming.
- To appreciate what OOP does, we need to understand what these limitations are and how they arose from traditional programming languages.
Basic Concepts of oops
3. Data Abstraction
4. Data Encapsulation
7. Dynamic binding
8. Message Passing
Objects are the basic run‐time entities of an object oriented system. • They may represent a person, a place or any item that the program must handle.When a program is executed, the objects interact by sending messages to one another. • For e.g. if “customer” and “account” are two objects in a program, then the customer object may send a message to the account object requesting for the bank balance. • Each object contains data, and code to manipulate the data.
Classes are user‐defined data types and it behaves like built in types of programming language. • Object contains code and data which can be made user define type using class. • Objects are variables of class. • Once a class has been defined we can create any number of objects for that class. • A class is collections of objects of similar type.
Encapsulation is the first pillar or principle of object‐oriented programming. In simple words, “Encapsulation is a process of binding data members (variables, properties) and member functions (methods) into a single unit”. And Class is the best example of encapsulation.
Through Encapsulation, Data is not accessible to the outside world, and only those functions which are wrapped in the class can access it. Encapsulation solves the problem at the implementation level. A class can specify how accessible each of its members (variables, properties, and methods) is to code outside of the class
So encapsulation means hiding the important features of a class which is not been needed to be exposed outside of a class and exposing only necessary things of a class. Here hidden part of a class acts like Encapsulation and exposed part of a class acts like
Abstraction refers representation of necessary features without including more details or explanations. Data abstraction is a programming (and design) technique that relies on the separation of interface and implementation.