Difference between Instance and Object
-
Instance refers to the copy of the object at a particular time whereas object refers to the memory address of the class.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
-
Instance refers to the copy of the object at a particular time whereas object refers to the memory address of the class.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
-
Class A { public void get() { Console.WriteLine("Hello"); } } Public Static Void Main(..) { A e=new A();/b> e.get(); } Here, A e=new A(); is instance or object Can you expain a bit more
-
Class A { public void get() { Console.WriteLine("Hello"); } } Public Static Void Main(..) { A e=new A();/b> e.get(); } Here, A e=new A(); is instance or object Can you expain a bit more
-
Hmmm... terminology is a bit blurry perhaps. Isn't object equivalent to instance? In school we learned that "An object is the result of instantiating a class". So if we have the class 'Dog', Spike and Lassie are objects of type 'Dog' or instances of the 'Dog' class. Just like objects in real life...
-
Hmmm... terminology is a bit blurry perhaps. Isn't object equivalent to instance? In school we learned that "An object is the result of instantiating a class". So if we have the class 'Dog', Spike and Lassie are objects of type 'Dog' or instances of the 'Dog' class. Just like objects in real life...
blackjack2150 wrote:
Hmmm... terminology is a bit blurry perhaps. Isn't object equivalent to instance?
The terms class and instance are pretty clear. The term object on the other hand is trickier, as it's sometimes used to mean a class, sometimes used to mean any instance of a class, and sometimes used to mean a specific instance of a class.
Despite everything, the person most likely to be fooling you next is yourself.
-
blackjack2150 wrote:
Hmmm... terminology is a bit blurry perhaps. Isn't object equivalent to instance?
The terms class and instance are pretty clear. The term object on the other hand is trickier, as it's sometimes used to mean a class, sometimes used to mean any instance of a class, and sometimes used to mean a specific instance of a class.
Despite everything, the person most likely to be fooling you next is yourself.
-
Class A { public void get() { Console.WriteLine("Hello"); } } Public Static Void Main(..) { A e=new A();/b> e.get(); } Here, A e=new A(); is instance or object Can you expain a bit more
.NET- India wrote:
Here, A e=new A(); is instance or object
The term object is not very clear, as both the class A and an instance of the class A can be called an object. e is a variable that can hold a reference to an instance of the class A (or any of it's decendants if there were any). new A() creates an instance of the class A. The value of the expression is the reference to the created instance, which is stored in the variable e.
Despite everything, the person most likely to be fooling you next is yourself.
-
.NET- India wrote:
Here, A e=new A(); is instance or object
The term object is not very clear, as both the class A and an instance of the class A can be called an object. e is a variable that can hold a reference to an instance of the class A (or any of it's decendants if there were any). new A() creates an instance of the class A. The value of the expression is the reference to the created instance, which is stored in the variable e.
Despite everything, the person most likely to be fooling you next is yourself.
-
So wht's a differnce between Instance and Object ????????????? A e=new A(); Here A is Object and e is instance Is it ryt as mentioned by one of the member above
.NET- India wrote:
So wht's a differnce between Instance and Object ?????????????
A big difference and none at all. It seems like your question mark key is stuck. Have you spilled too much cola in the keyboard? ;)
.NET- India wrote:
A e=new A(); Here A is Object and e is instance Is it ryt as mentioned by one of the member above
A is a class, and it can be called an object, but also an instance of the class A can be called an object. The variable e is not at all an instance of the class, it's a reference variable that can hold a reference to an instance of the class A.
Despite everything, the person most likely to be fooling you next is yourself.
-
Actuallly sir in an interview i was asked this question "What is the difference between Instance and Object". So how should i define it??????