C# 0 The Complete Reference


ExceptB  is derived from  ExceptA



Download 4,07 Mb.
Pdf ko'rish
bet467/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   463   464   465   466   467   468   469   470   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

ExceptB

 is derived from 



ExceptA

, the 


catch

 for 


ExceptB

 must be before the one 

for

ExceptA

. Similarly, the 



catch

 for 


Exception

 (which is the base class for all exceptions) 

must appear last. To prove this point for yourself, try rearranging the 

catch

clauses. Doing 

so will result in a compile-time error.

One good use of a base class 



catch

 clause is to catch an entire category of exceptions. For 

example, imagine you are creating a set of exceptions for some device. If you derive all of 

the exceptions from a common base class, then applications that don’t need to know precisely 

what problem occurred could simply catch the base class exception, avoiding the unnecessary 

duplication of code.

www.freepdf-books.com



360

 

P a r t   I :  



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


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   463   464   465   466   467   468   469   470   ...   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