Is class an Object? Is object a class?
Answers were Sorted based on User's Feedback
Answer / kumar rohit
A class is a generalized template from which object
is created based on its various instances,therefore
we can consider a class as an object while vice-versa
is not possible.
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / murthy
A class is neither an object nor an object is a class.
A class is like a blue print for an object.
An object is an instance of a class.
Some people have given the right examples above and some
more goes here:
You can consider a blue print for your house is a class.
You cannot stay in blue print :).
The building built based on the blue print is called an
object. You can stay in it.
Class should be treated like a "data type" and an object
like a instance of that datatype.
for e.g., int i; you can considet int as a class and i as
an instance of an object.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / vasir
Class is not an object. An object is an entity that is
allocated memory during runtime to do certain operation
whereas Class is just a skeleton or representation of the
object. We say design a class and not create a class. We
can only design a class ( attributes and behaviour ).
In brief we can say class is a Type of an object.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / subrata
Going by the definition ("object is an instance of a class") - it is clear that object IS A class type (take off "an instance of"). However, the other way round is against the correctness of definition.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / shambhu gupta
Class is a user defined data type whereas Object can be
veiwed as a variable of class type
For example fruit is a class & mango,apple are different
objects of class fruit.
Class can be a person whereas objects can be any existing
person like Ram ,Shayam,Rahul etc
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / julian c
Stop thinking like programmers saying "Object is a class in Java, c# etc".
I have in front of me a number of Whiffleplops of different colours; black, blue and red.
The black, blue and red Whiffleplops are three different objects. They are also of different sizes and I can play with them.
Do you have a Whiffleplop with you? No? (Why not).
Do you see that Whiffleplop is a CLASS of object that I can define as having two attributes (colour and size) and behaviour (you can play with it)? When you do get a Whiffleplop of any size or colour then you'll have an object, or an instance of the Whiffleplop class. You don;t have to have one for me to define the class though!
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / kaushi
object is an instance of a class or in other words object
is a snapshot(blueprint)of a perticuler class.
class is real world object.
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / reza
Yes, class is an object but an object is not a class.
We can compare class with a factory and object with product.
A factory can be a product of another factory; but a
product can not be a factory.
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / anu
YES class is an object whereas an object is an instance of
a class
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / anirban
Class is an object.
But an object is not a class.
Is This Answer Correct ? | 2 Yes | 4 No |
What is the order of call of constructors in inheritiance?
Can you create an instance for an abstract class?
What is difference between static and non-static fields of a class?
what are the different ways for a method to be overloaded?
Comment: C++ "includes" behavior and java "imports"
Giving reasons explain two external responsibilities of a project manager.
Can we override static methods? Why?
What is a default method? Why do we need default methods in java 8 interfaces?
What is static polymorphism?
Explain about overriding polymorphism?
Why dynamic binding is used in object-oriented programming?
What is the use of interface?