What is the difference between an object and an instance? Please explain with a suitable example.
thanks in advance !
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Krishna GaradRank #191 · 12.8K reputationPosted Mar 16, 2011, 9:01 PM EDT
Public Class Class1
{
//Implemetation
}
This class is nothing but the object which actully hold the Implementation. For accessing the functionality of this class we may instanciate this class like bellow which the instance or reference to our object.
Class1 obj=new Class1();
Whenever we create instance of our object then that object intializers must fire first in our case Constructor of our class will fire first. And one more thing is that when we create any object it will not occupy any space on memory but when we create instance of object then only memory will be occupy for specific object.
VulpesRank #55 · 29.2K reputationPosted Mar 17, 2011, 1:06 AM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Mar 17, 2011, 10:36 PM EDT
An object is something that is vague, unclear and ambiguous. You can't ever be sure what it is without asking the person using the term or understanding the context and/or looking for a definition relevant to that context. So you need to know your instructor's definition. If you use our definition in your answer for your class, the instructor might say it is wrong.