Everything You need to know to get started with Object Oriented programming.|| INTRODUCTION TO OOP

         In this post, We are going to be talking about Object Orientation in a programming language and we'll also be talking about a bunch of stuff that's in it. Clean up your mind, keep it real empty for now, if you have searched or read something about it from somewhere.

    Prerequisites:

  1. You should know basic programming(Loops, Conditional statements, Functions, Pointers) and have a little experience of it.                 
        Firstly I would tell you that the object orientation in a programming language is just another concept like Functions and Pointer so, there's nothing extraordinary about it as you may feel about it after reading the word "OBJECT-ORIENTED PROGRAMMING!".

  • Attributes and Classes.

        Imagine a scenario, Think about a Car and try to point out what characteristic does a car have. You might come up with a few like, Name of the Car, Name of the brand, Color, type of Engine it has, and category of car. Alright, now I would ask you a question, Have you ever dreamed about having your own DATA TYPE just like Int, Float, String where you can put whatever you want like a Car and all its characteristics...... are you getting what I am trying to point out here? Yes! with the help of OOP, you can actually store characteristics of an "OBJECT" which are ultimately called "ATTRIBUTES" in the language of programming. that means "color", "name", "engine type", are the "ATTRIBUTES" of an " OBJECT" named as "car". Now the question is how do we create this DATA TYPE?. The answer is with the help of "CLASS". Now you might say What is class?. Class is like a Universal kind of data type which after naming becomes our own data type. for eg. if there is a bar of normal chocolate, then we call it a chocolate bar, and when it's wrapped with harshey's wrapper we say its Hershey's chocolate bar. it's exactly similar, We name our class with any name we want, and that name now becomes our brand new custom data type, that we build for ourselves. For eg., if I declare "class Vehicles" then "Vehicles" is now my own data type.

  • Methods

        Now let's get to another point. We all are familiar with a term called "Functions". Functions are the distinct pieces of code that we can call as many times as we want to perform desired operations. When we write a function inside of the Class it becomes "METHOD". Methods are the functions that can access the attributes and the variables declared inside the class and it can perform any operation you like as long as you are able to program it. for eg. I can create a function "tellme()" which prints all the values of attributes of my object when I call it on my object. ("car.tellme()") You just have to act smart to get your work done with methods.

  • What is actually an Object?

now let's talk about "OBJECTS". What are objects? to answer this question we need to first understand that all the arrangement that we made inside the class is the kind of like a blueprint. what do I mean by that? let's take an example. You may have noticed that many times Houses in outside Countries are Identical in every manner. I mean like in each and every aspect all houses are similar. So there must be a blueprint of the structure of the house. and that blueprint is used to create all the houses. that is why they are identical. this blueprint is what we consider our class. and when we create a house in accordance with the blueprint then that house is what we call "OBJECT" in programming. i,e when we declare a "Variable" of our "CLASS" then it's actually an "OBJECT". An object is also called as an "instance of a class" that is straightforward to understand. 

If you read it carefully:

  1. Vehicle=Class
  2. car=Object
  3. name,brand,engine,category=Attributes
  4. tellme()=Method


So these were the most basic 3-4 things, that you needed to get started with learning object orientation in a programming language.


Now let's try and implement all this in code and let's dig into it a little bit better and let's get technical.

I have written the Code with Easiest Explanation in C++ and Python. You can basically read anyone you like. Here are the links to those posts.

Click Here For C++


That's all for this post. I hope You liked it. If you feel this post can help others as well then share it with friends. lets spread knowledge and support community.

Leave comments if you have any kind of doubt or suggestions. Kindly follow my blog if you liked my content. and react to the post about how you felt about it.


Thank You for Reading...!

PEACE✌

3 comments:

Harshal said...

Keep writing bro this knowledge is really helpful for me

Unknown said...

Conceptual.. 💯💯👍🏻👍🏻

Atharva said...

Very nice

Post a Comment

Everything You need to know to get started with Object Oriented programming.|| INTRODUCTION TO OOP

            In this post, We are going to be talking about Object Orientation in a programming language and we'll also be talking about ...