-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Dharshan08
Message 10 in Discussion

Hi every one,

This is my first mail.
Firstly thanks for evry one who's giving info.

Regarding this 'int' discussion i would like to add something.

int i=value; and
int i=new int();
r having the difference.

As bineesh had said
in the 1st case i is initialized to 'value'
in 2nd case i will be initialized to the default value of Int32
datatype(it is 0)

because in 2nd case we r using 'new' operator which calls the default cons'rt.

And to Mrinal
in the first case it is not initialized to zero.
If we just declare 'i' n try to print it, it will throw an error
saying "use of unassignned local variable i". Which means that it is
not initialized to zero(it will show some junk value in c++, but it is
taken care at the runtime in c#).

It is some thing like we have a struct/class by name A.
And a statement    A a1;
does not initialize any thing until we assign something or initialize
it will cons'rt or new operator.Here we r not referencing it to
anything.

And in both the casses it get stored on stack because in c# integer
types r defined as STRUCT.

I think this is clearing all doubts regarding this issue.

regards

Dharshan


-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to