A POCKET GUIDE TO OBJECT-ORIENTED PROGRAMMING (OOP)

Objects

So what are objects? Although, we might not need any further elaboration of Objects in our real world. But, we should know and understand some key concepts about Objects in OOP before moving onto slight complex and advance concepts.

If a class Human represent all objects of type human, than an Object is just one human. It is that simple or in other words.

An Object refer to one unit or entity of a Class.

And in programming world where objects can be defined or created, and also because of the fact that objects are just special type of variables, and variables are used to store information for a computer program, we needed a special term for objects instead of unit or entity of a class.

There is another similar word or term come into my mind. i.e. Instance. As per urban dictionary, an ‘Instance’ is an example or single occurrence of anything. And an Object represent a single unit or entity of a Class. Therefore, we can also rephrase our definition of Objects like this.

An Object is an instance of a Class with unique characteristics or properties.

Object initialization also mean storing relevant information in an object. For example, an object representing a human will have all relevant information stored in it on it’s initialization or creation. Information or data stored on an object instance is also known as ‘State’ of an object. Think of it as a real person who has physical appearance, looks and other identify information, relevant to it, available to represent that person for us in real world. Similarly, when you want to represent that person in a computer program. You will have to store all relevant information in its object and this information will represent state of that object or person in a program.

I hope you have fully understood this concept of Objects in OOP. Please post your questions as comments below, just in case if you have any confusion. I will be happy to help.

Let’s discuss Properties in detail in our next chapter. Please click ‘Next’ to continue.

Image placeholder

Hi! I'm Zeeshan Elahi

I have compiled and prepared this content with love for people like me and you. And as you know it always take some time and extra cups of coffee to read, compile and prepare a course or manual. If you have like reading this content and want to say thanks, please consider supporting from more stuff like this.

Leave a comment

Your email address will not be published. Required fields are marked *

*

*