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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Mar 18, 2011, 2:36 AM
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.
VulpesPosted Mar 17, 2011, 5:06 AM
Krishna GaradPosted Mar 17, 2011, 1:01 AM
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.