Basic OOP concept

Class, Property, Method, and object

oop basic concept methods, class, property, attribute, instance, instansication

Class

A class is a collection of similar objects that have same property/attribute and methods/behavior. A class is a building block of OOP and objects. The objects of the same type lie in a class.  A class is used to define the behavior of object based on that object property

Example: A Honda City car lies in a class because all Honda City Cars of a particular model have the same property. Engine Power, Model, Speed, Limit, Color and perform same basic functions/method/behavior (Start, Stop, Forward Backward), etc.

Property

A property is a characteristics or attribute of an object which will be defined in a class. For example in the above example Engine Power, Model, Speed Limit, Color are the property/Attribute/Characteristics of a Car.

State

The values of property/attribute an object indicate the state of that object.

Example: Engine Power = 16,00CC;

Model = 2016;

Speed Limit = 250;

Color = Black;

So here the values of the attribute of object car show the state of a car object.

Method

Methods are the behavior or function of an object that can be performed by the object. Methods also called the tasks or action of the objects.

Example: Taking methods from the above example. Start(), Stop(), Backward(), Forward() etc. are the basic action/function or method of a car object.

Object

An object is an entity or anything that have some property/behavior/attribute and actions/methods/functions

An object can be a thing, concept place, person, real world object, etc.

Instance/Instantiation

When we create the object of a class, it is also the instance. The process of creating the object from a class is called instantiation.

Leave a Reply

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

Protected by WP Anti Spam