What is Object oriented programing ?
- Object-oriented programming AKA OOP's is a programmatical concept which is used in most of modern programming languages as a building block such as C#, Python ,Ruby etc.
- Languages based on OOPs are basically working on classes and their objects.
Characteristics of Object-Oriented Programming
Object-oriented programing has 5 main characteristics as below:
- Classes and Objects:
For the simple definition, we can say that classes are the blueprints using which we can design the shape and structure of the object. An object is an instance of the class where the properties of the class are the state of the object and methods and function of the class are the behavior of the object.
Let's understand the above definitions with a real-world example:Assume that you are writing a program on a school application to store school data, so before working any operation on school data we need to create a structure or you can say model of the school where we need to define how our school data will look like. So to achieve that we can create a class of school because "Class is a blueprint to store state and behavior of object".
Once we are done with our blueprint i.e. class than we can create an instance of it that is known as an object. For objects, the properties of the class will be its state and methods of the class will be its behavior.
- Abstraction:
Abstraction is the second pillar of the OOP's. Abstraction states hiding unnecessary data from the user and only displaying the required data.
API are an example of the abstraction where the user can only consume the API but the implementation of API is unknown to the user.
We can achieve the abstraction using an access specifier in C#
0 Comments