Learn about Class, Object and Instance in object-oriented programming

Class, Object and Instance are the basic concepts in object-oriented programming (OOP) that learners need to understand.

In the framework of this article, we will take a look at some really basic concepts in object-oriented programming (OOP) that learners need to understand, thereby understanding how the Class works. and wider is how OOP works.

The truth is that the disjoint between the philosophical aspect of development and the actual mechanical activities of computers in object-oriented programming often creates confusion.These two concepts can be distinguished as follows:

The basic concept of OOP is: Class >> Object >> Instance.

Class is like a blueprint.Objects are real objects built on this design (like a house).The instance is a virtual (non-real) copy of Object.

The following sentences often cause confusion for learners by the terms being mixed and combined together in non-intuitive ways:

The first argument that init () receives is used to denote the instance object.

But it is much easier to understand if you interpret the sentence in the following way:

A detailed design for the house is like describing a class. All the houses built on that design are objects of the class. A specific house is an instance.

Finally, try to remember the following when object-oriented programming:

The main difference between a function and a class is: The function is 'floated' comfortably without obstruction.While for Class (instance) must know its parent class (properties of the parent class), so you need to know the methods of reference to the parent class of the class.It is just a small underground rule that you must grasp before going into OOP.Many programming languages ​​use slick syntax instead of simple simplicity, if you are tired of it, you can try Python, this programming language that values ​​simplicity and accessibility for user.

See more:

  1. Beginners of computer programming need to focus on what?
  2. 8 websites that help programmers practice coding skills
  3. Object-oriented programming in PHP
4.7 ★ | 3 Vote