Experiment 1.

Data abstraction

#lncludeƼlosLreamŦhƽ
#lncludeƼconloŦhƽ
#lncludeƼsLrlngŦhƽ
class car
ž
lnL Lop_speedŤ
char colorż10ŽŤ
publlcť
vold geL_daLa()
ž
couLƼƼƍŲnenLer Lop speed ƹ ƍŤ
clnƽƽLop_speedŤ
couLƼƼƍenLer color ƹ ƍŤ
clnƽƽcolorŤ

ſ
vold dlsplay()
ž
couLƼƼƍŲnrecord lsƍŤ
couLƼƼƍ Lop speed ƹ ƍƼƼLop_speedƼƼƍ color ƹ ƍƼƼcolorŤ
ſ
ſŤ
vold maln()
ž
clrscr()Ť
car bmwţaudlŤ
couLƼƼƍenLer daLa of bmwƍŤ
bmwŦgeL_daLa()Ť
couLƼƼƍŲnenLer daLa of audlƍŤ
audlŦgeL_daLa()Ť
couLƼƼƍŲnlnformaLlon of bmwƍŤ
bmwŦdlsplay()Ť
couLƼƼƍŲnŲnlnformaLlon of audlƍŤ
audlŦdlsplay()Ť
geLch()Ť
ſ










D@9D@ť

enLer daLa of bmw
enLer Lop speed ƹ 330
enLer color ƹ red

enLer daLa of audl
enLer Lop speed ƹ 400
enLer color ƹ blue

lnformaLlon of bmw
record ls Lop speed ƹ 330 color ƹ red

lnformaLlon of audl
record ls Lop speed ƹ 400 color ƹ blue

D@9D@   °  ff€ ¯ ° ½¾½   ° n    °  ff€f  ° ½¾½   ° n     °€¯f°€ ¯  n ¾½¾½  n    °€¯f°€f   n ¾½¾½  n                                 .

Sign up to vote on this title
UsefulNot useful