0
What is the difference between an attribute and an object?
3 Answers
+ 1
An object is an instance of a class (class is like a blue print, like a description of the parts of something)
Objects are made of attributes(variables inside the class) and methods
+ 1
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. new keyword is used to allocating the memory for an object of a class.Â
we can say to refer a class by another class, we create the object of that class.Â
attributes defines the properties of the class.Â
they are member variables of a class . they can be instance variables or class variables(static variables).Â
for exampleÂ
if u have a class called "student"Â
the common attributes of student class (we can say member variables)Â
can be: ID, name, rollno, etc.Â
to access these variables from another class or from main method , we have to create the instance or object of that class.
0
thank-you guys!đ