C# 0 The Complete Reference


Building . Thus,  house



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

Building

. Thus, 


house

 is a 


variable that can refer to an object, but it is not an object, itself. The next line creates a new 

Building

 object and assigns a reference to it to 



house

. Now, 


house

 is linked with an object.

The fact that class objects are accessed through a reference explains why classes are 

called


reference types.

 The key difference between value types and reference types is what 

a variable of each type means. For a value type variable, the variable, itself, contains the 

value. For example, given

int x;

x = 10;


x

 contains the value 10 because 



x

 is a variable of type 



int

, which is a value type. However, in 

the case of

Building house = new Building();



house

 does not, itself, contain the object. Instead, it contains a reference to the object.




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   168   169   170   171   172   173   174   175   ...   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