Concept of Object-Oriented Programming Concept
- Object Oriented Programming is performed by using class and object.
- Class is a set of States and behaviors.
- Class is also known as a blue print of an object.
- Class is called an Object factory where more than one object is created.
- The object is used for accessing all the functionality of Class.
- An example of Class and Object is
- CAR----> It is a class
- Wagon R, Maruti 800, Alto, Seltos, etc are examples of objects.
- Object-Oriented Principle:-
- Encapsulation:- It is a process of binding the data and method in a single unit. A general example of encapsulation is Capsules, Bike, Cake, and others where the data is wrapped in a single unit. The Class is also an example of Encapsulation because Class also binds the state and behavior.
- Abstraction: Abstraction is a process where only essential information is shown for use and unnecessary information about an object is hidden from the user. ATM is an example of Abstraction where users only access essential data. In programming the scope of data(Public, Private, Protected) helps to abstract the data from the user.
- Polymorphism:- Polymorphism is made up of two words: Ploy--> Many and Morphism--> Forms. Polymorphism helps to use a single name function with multiple arguments. It helps the programmer to prevent learning the different names of functions.
- Inheritance:- Inheritance allows to access the property of Base Class(Parent Class) to Sub Class(Child Class). With the help of Inheritance, the code is reusable and shared with an object. For Ex.:- The Property of a parent can be accessible by the child.
Comments
Post a Comment