This print for content only-size & color not accurate 7" X 9-1/4" / casebound / malloy


Figure 6-8. The Employee hierarchy ■



Download 21,46 Mb.
Pdf ko'rish
bet417/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   413   414   415   416   417   418   419   420   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

Figure 6-8.

The Employee hierarchy



Source Code

The Employees project is included under the Chapter 6 subdirectory.



Building a Polymorphic Interface

When a class has been defined as an abstract base class (via the abstract keyword), it may define

any number of abstract members. Abstract members can be used whenever you wish to define a

member that does 



not supply a default implementation. By doing so, you enforce a polymorphic

interface on each descendent, leaving them to contend with the task of providing the details behind

your abstract methods.

Simply put, an abstract base class’s polymorphic interface simply refers to its set of virtual and

abstract methods. This is much more interesting than first meets the eye, as this trait of OOP allows

us to build very extendable and flexible software applications. To illustrate, we will be implementing

(and slightly modifying) the hierarchy of shapes briefly examined in Chapter 5 during our overview

of the pillars of OOP. To begin, create a new C# Console Application project named Shapes.

In Figure 6-9, notice that the Hexagon and Circle types each extend the Shape base class. Like

any base class, Shape defines a number of members (a PetName property and Draw() method in this

case) that are common to all descendents.

C H A P T E R   6  


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   413   414   415   416   417   418   419   420   ...   1830




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