C# 0 The Complete Reference


Rectangle  class includes  TwoDShape



Download 4,07 Mb.
Pdf ko'rish
bet359/1096
Sana23.01.2022
Hajmi4,07 Mb.
#402171
1   ...   355   356   357   358   359   360   361   362   ...   1096
Bog'liq
C-Sharp 3 The Complete Reference Herbert Schildt

    Bu sahifa navigatsiya:
  • Width
Rectangle

 class includes 



TwoDShape

 and adds the methods 



IsSquare( )

, which 


determines if the rectangle is square, and 

Area( )

, which computes the area of a rectangle.



Member Access and Inheritance

As explained in Chapter 8, members of a class are often declared private to prevent their 

unauthorized use or tampering. Inheriting a class 

does not

 overrule the private access 

restriction. Thus, even though a derived class includes all of the members of its base class, 

it cannot access those members of the base class that are private. For example, if, as shown 

here, 

Width

 and 


Height

 are made private in 



TwoDShape

, then 


Triangle

 will not be able to 

access them:

// Access to private members is not inherited.

// This example will not compile.

using System;

// A class for two-dimensional objects.

class TwoDShape {

www.freepdf-books.com



Download 4,07 Mb.

Do'stlaringiz bilan baham:
1   ...   355   356   357   358   359   360   361   362   ...   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