0

What is the difference between an attribute and an object?

26th Nov 2016, 2:37 PM
alonewolf
alonewolf - avatar
3 ответов
+ 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
26th Nov 2016, 3:07 PM
Dago VF
Dago VF - avatar
+ 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.
26th Nov 2016, 3:32 PM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar
0
thank-you guys!😀
27th Nov 2016, 1:55 AM
alonewolf
alonewolf - avatar