Difference between Object and Attribute


Object is an instance of a class, which you create by writing [cpp]classname obj=new classname();[/cpp]
we create the object to use the member variables and functions of a class. The [cpp]new[/cpp] keyword is used to allocate the memory for an object of a class.


An attribute is a characteristic of that object. Attributes are just another name given to data members. Sometimes attributes and also methods can be public or private. It means that the code outside the class can use them, or only the class code can have access.