C# 0 The Complete Reference



Download 4,07 Mb.
Pdf ko'rish
bet325/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   321   322   323   324   325   326   327   328   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

Nybble

 to 


int

 and 


from 

int

 to 


Nybble

, a 


Nybble

 object can be freely mixed in arithmetic expressions. For 

example, consider this expression from the program:

t = a * 2 + 3;

Here, 

t

 is an 


int

, as are 2 and 3, but 



a

 is a 


Nybble

. These two types are compatible in the 

expression because of the implicit conversion of 

Nybble

 to 


int

. In this case, since the rest 

of the expression is of type 

int

,

a

 is converted to 

int

 by its conversion method.

www.freepdf-books.com



244

 

P a r t   I :  



T h e   C #   L a n g u a g e

The conversion from 



int

 to 


Nybble

 allows a 



Nybble

 object to be assigned an 



int

 value. 


For example, in the program, the statement

a = 19;


works like this. The conversion operator from 

int

 to 


Nybble

 is executed. This causes a new 



Nybble

 object to be created that contains the low-order 4 bits of the value 19 (which is 3 

because 19 overflows the range of a 

Nybble

). This object is then assigned to 



a

. Without the 

conversion operators, such expressions would not be allowed.

The conversion of 




Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   321   322   323   324   325   326   327   328   ...   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