Instatiating object in class

Posted by krrishbiju-15589 under C# on 9/25/2013 | Points: 10 | Views : 1658 | Status : [Member] | Replies : 1
Hi,
Can anyone help me on this,

I have a class in c#

Class ABC()
{
}

1. If I create an object with class ABC, ABC ob=new ABC(), What will happened in memory.
2. If I create an object with class ABC, ABC ob;, What will happened in memory.
3.What is the difference between these two?
regards
krrish




Responses

Posted by: Bandi on: 9/25/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
ABC ob=new ABC()

will create an ABC object in memory by using constructor ( new ABC( )) and then the memory address of that object is being assigned to ob object reference of type ABC...

ABC ob;

It just declare an object reference for ABC; but not initialized/instantiated

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

krrishbiju-15589, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response