C# 0 The Complete Reference


Reference Variables and Assignment



Download 4,07 Mb.
Pdf ko'rish
bet173/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   169   170   171   172   173   174   175   176   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

Reference Variables and Assignment

In an assignment operation, reference variables act differently than do variables of a value 

type, such as 

int

. When you assign one value type variable to another, the situation is 

straightforward. The variable on the left receives a 

copy

 of the 


value

 of the variable on the 

right. When you assign one object reference variable to another, the situation is a bit more 

complicated because the assignment causes the reference variable on the left to refer to the 

same object to which the reference variable on the right refers. The object, itself, is not 

copied. The effect of this difference can cause some counterintuitive results. For example, 

consider the following fragment:

Building house1 = new Building();

Building house2 = house1;

At first glance, it is easy to think that 




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   169   170   171   172   173   174   175   176   ...   1096




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish