Objects and Classes in C++

Objects

  • ‘C’ is a collection of functions but ‘C++’ is a collection of class and object
  • Object is an instance of class
  • Allocating memory for members of class, is called as instance

 

eg :

int x

float y                                  instance

employee emp

 

What do you mean by SBI of an object  ?

SBI  -  - > state behavior identity

  • SBI stand for state, Behavior and identity since every object has the above the rule

State :  It is a just a value to the attribute of an object at a particular time.

Behavior    It describes the action and their reactions of that object

Identity :   An object has an identity that characterizes its own existence

 

Screenshot_1

 

 

ClassObject
Data type/ user definedInstance of class
It is a logical entityObject is a physical entity
Class does not have stateit having state.