+ 3
Every Object has an identity, attribute and Behaviour. Attribute and Behaviour for an object is given by a Class.
6 Antworten
+ 1
Yes you are right. Take the example written below
Class Person
{
int age;
string name;
void function()
{.....}
};
When u create a person object in main() it has its own identity in the memory which tells that the object is of class type person.
Attributes from the above snippet: age, name.
behavior : function(method) that u implement inside the class.
+ 1
Thanks for elaborating 😇 and i guess identity is derived from the values given to the attributes
0
Object identity tells about the class it belongs to.
0
Then how can different objects vary and have their unique identity in a same class itself 🤔
0
For example u create an object name Akash which contains the attributes defining ur age and name.
Now if I create an object satyendra then it contains the age and name of mine.Object Akash will be different from object satyendra. They both have different identities.
0
Hi.