Difference between Object and Attribute


Object is an instance of a class, which you create by writing classname obj=new classname();
we create the object to use the member variables and functions of a class. The new 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.