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
Class | Object |
Data type/ user defined | Instance of class |
It is a logical entity | Object is a physical entity |
Class does not have state | it having state. |