+ 4
Difference between class and object?
11 ответов
+ 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.
+ 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.
+ 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.
+ 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.
+ 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.
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.
0
hy dear
0
Object is an instance of class and class in a blueprint of an object
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.
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.
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!