Objects Abstrac,on Abstrac,on is the process of - - PowerPoint PPT Presentation

objects abstrac on
SMART_READER_LITE
LIVE PREVIEW

Objects Abstrac,on Abstrac,on is the process of - - PowerPoint PPT Presentation

Objects Abstrac,on Abstrac,on is the process of capturing only those ideas about a concept that are relevant to the current situa,on. Abstrac,on


slide-1
SLIDE 1

Objects ¡

slide-2
SLIDE 2
slide-3
SLIDE 3
slide-4
SLIDE 4

Abstrac,on ¡

  • Abstrac,on ¡is ¡the ¡

process ¡of ¡capturing ¡

  • nly ¡those ¡ideas ¡

about ¡a ¡concept ¡that ¡ are ¡relevant ¡to ¡the ¡ current ¡situa,on. ¡

slide-5
SLIDE 5

Abstrac,on ¡

  • Control ¡abstrac,on: ¡Giving ¡func,on ¡names ¡to ¡

sec,ons ¡of ¡code ¡that ¡then ¡"stand" ¡for ¡that ¡

  • code. ¡
  • When ¡we ¡call ¡a ¡func,on, ¡we ¡don't ¡care ¡how ¡

the ¡func,on ¡works, ¡we ¡just ¡care ¡that ¡it ¡does ¡

  • work. ¡

– We ¡have ¡captured ¡the ¡meaning ¡of ¡a ¡sec,on ¡of ¡ code ¡by ¡giving ¡it ¡a ¡name, ¡while ¡giving ¡the ¡caller ¡of ¡ the ¡func,on ¡the ¡ability ¡to ¡ignore ¡how ¡it ¡works. ¡

slide-6
SLIDE 6

Abstrac,on ¡

  • Data ¡abstrac,on: ¡Choosing ¡to ¡represent ¡a ¡

concept ¡by ¡certain ¡features ¡and ¡ignoring ¡

  • thers. ¡
  • So ¡far, ¡we ¡can ¡

use ¡structs ¡ for ¡this. ¡

slide-7
SLIDE 7

Classes ¡

  • Classes ¡= ¡Structs ¡+ ¡Func,ons ¡
  • A ¡class ¡is ¡a ¡struct ¡with ¡some ¡func,ons ¡

associated ¡with ¡it ¡that ¡act ¡upon ¡that ¡struct. ¡

  • The ¡point ¡of ¡a ¡class ¡is ¡to ¡combine ¡data ¡

abstrac,ons ¡(a ¡struct) ¡with ¡appropriate ¡ control ¡abstrac,ons ¡(func,ons), ¡resul,ng ¡in ¡

  • ne ¡en,ty ¡that ¡has ¡state ¡(variables) ¡and ¡

associated ¡behaviors ¡(func,ons). ¡

slide-8
SLIDE 8

Design ¡a ¡class ¡

slide-9
SLIDE 9

Designing ¡a ¡class ¡

  • Classes ¡are ¡declared ¡like ¡structs, ¡but ¡have ¡

public ¡and ¡private ¡sec,ons. ¡

  • Anything ¡in ¡the ¡public ¡sec,on ¡is ¡accessible ¡by ¡

a ¡programmer ¡using ¡the ¡class. ¡

  • Anything ¡in ¡the ¡private ¡sec,on ¡is ¡accessible ¡
  • nly ¡by ¡the ¡programmer ¡wri,ng ¡the ¡class. ¡
  • (More ¡about ¡this ¡later.) ¡