Author Dusty Phillips Reviewers


Barrel . Reading from right to  left, exactly one  Barrel



Download 2,95 Mb.
Pdf ko'rish
bet15/183
Sana20.07.2022
Hajmi2,95 Mb.
#831085
1   ...   11   12   13   14   15   16   17   18   ...   183
Bog'liq
python3-oop

Barrel
. Reading from right to 
left, exactly one 
Barrel
can be associated with any one 
Apple
.
Specifying attributes and behaviors
We now have a grasp of some basic object-oriented terminology. Objects are 
instances of classes that can be associated with each other. An object instance is a 
specific object with its own set of data and behaviors; a specific orange on the table 
in front of us is said to be an instance of the general class of oranges. That's simple 
enough, but what are these data and behaviors that are associated with each object?
www.it-ebooks.info


Object-oriented Design
[
 6 
]
Data describes objects
Let's start with data. Data typically represents the individual characteristics of a 
certain object. A
class can define specific sets of characteristics that are shared by all 
objects of that class. Any specific object can have different data values for the given 
characteristics. For example, our three oranges on the table (if we haven't eaten any) 
could each weigh a different amount. The orange class could then have a weight 
attribute
. All instances of the orange class have a weight attribute, but each orange 
has a different value for this attribute. Attributes don't have to be unique, though; any 
two oranges may weigh the same amount. As a more realistic example, two objects 
representing different customers might have the same value for a first name attribute.
Attributes are frequently referred to as 
members
or 
properties
. Some authors 
suggest that the terms have different meanings, usually that attributes are settable, 
while properties are read-only. In Python, the concept of "read-only" is rather 
pointless, so throughout this book, we'll see the two terms used interchangeably. In 
addition, as we'll discuss in 
Chapter 5

When to Use Object-oriented Programming
, the 
property keyword has a special meaning in Python for a particular kind of attribute.

Download 2,95 Mb.

Do'stlaringiz bilan baham:
1   ...   11   12   13   14   15   16   17   18   ...   183




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