Difference between class and object? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Difference between class and object?

14th Nov 2016, 6:36 PM
Ermyas
Ermyas - avatar
11 Answers
+ 20
An object is an instance of a class. A class is the definition of an object. It does not actually become an object until it is instantiated. Since an abstract class can't be instantiated, no object of that type can created. A sub class would need to be defined in order for an object to created.
15th Nov 2016, 11:49 AM
Remmae
Remmae - avatar
+ 4
class is the origination of something. object is what is being originated. In simple terms. your family is a class - family you and your family members are all objects which comprises of. - firstName, LastName, Age, height, weight e.t.c so for us to make it work. family you; - you are the first son family brother2; - your brother is the second son family sister1; - your first sister you.firstName = "james"; you.lastName = "Bills"; brother2.firstName = "randy"; sister1.firstName = "jane"; In general, a class comprises of the attribute and behavior of an object while an object posses the features defined in a class.
14th Nov 2016, 8:29 PM
Franky BrainBox
Franky BrainBox - avatar
+ 2
An object is a member or an "instance" of a class. An object has a state in which all of its properties have values that you either explicitly define or that are defined by default settings. This subtle conceptual difference between classes and objects shows why there is a tendency to want to use them interchangeably.
14th Nov 2016, 10:19 PM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar
+ 1
The object is an instance of a class. Remember the declaration of an integer. you can not do anything with int. but if you declare a variable which type is int, you can use the variable.
14th Nov 2016, 6:43 PM
Marcell Juhasz
+ 1
An object is a member or an "instance" of a class. An object has a state in which all of its properties have values that you either explicitly define or that are defined by default settings. This subtle conceptual difference betweenclasses and objects shows why there is a tendency to want to use them interchangeably.
16th Nov 2016, 7:49 AM
Vishal Mahato
Vishal Mahato - avatar
0
class is a combination of member functions and data members are keep in visibility of public and private and protect sections. intially there is no memory is allocated to the class in computers memory.when you create an object for respected class then memory is allocated to class in the computers memory. object is blueprint of class.
15th Nov 2016, 3:14 PM
Kasireddy venkateswarlu
Kasireddy venkateswarlu - avatar
0
hy dear
15th Nov 2016, 6:16 PM
Ashiq khosa
Ashiq khosa - avatar
0
Object is an instance of class and class in a blueprint of an object
15th Nov 2016, 7:09 PM
sudhir ranjan rout
0
class is logical behavior where as object is physical. for example if I say vehicle. you can't exactly say how a vehicle is. it can have 2wheel or 4 or 6 or 8. so, vehicle is logical . in this case you would consider vehicle is a class where as if I say a car or a bus or a scooter then you know how exactly a car is or a bus is . so, car ,bus, scooter are object of vehicle class. as car, bus, scooter has physical existence.
18th Nov 2016, 3:55 AM
Anil Kumar
Anil Kumar - avatar
0
You can understand it by supposing Object is like functionname, and Class is like definition of that function. Class is something which contains methods, variables etc. Object is a pointer to a class. Class has the definition or you can say class has functionality. To access that functionality there must be an Object of that class.
18th Nov 2016, 6:53 AM
Jai Verma
Jai Verma - avatar
0
class is a box that is containing same type of objects with different identities like you can say a class of vehicle contain bus,truck,car etc as objects!
26th Nov 2016, 3:19 AM
Muhammed Ibrahim Anjum
Muhammed Ibrahim Anjum - avatar