C# 0 The Complete Reference


PART I C h a p t e r   1 1



Download 4,07 Mb.
Pdf ko'rish
bet397/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   393   394   395   396   397   398   399   400   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt


PART I

C h a p t e r   1 1 :  

I n h e r i t a n c e  

305


PART IPART I

Using sealed to Prevent Inheritance

As powerful and useful as inheritance is, sometimes you will want to prevent it. For 

example, you might have a class that encapsulates the initialization sequence of some 

specialized hardware device, such as a medical monitor. In this case, you don’t want users 

of your class to be able to change the way the monitor is initialized, possibly setting the 

device incorrectly. Whatever the reason, in C# it is easy to prevent a class from being 

inherited by using the keyword 

sealed

.

To prevent a class from being inherited, precede its declaration with 



sealed

. As you 

might expect, it is illegal to declare a class as both 


Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   393   394   395   396   397   398   399   400   ...   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