??????? (Wrapper) - PowerPoint PPT Presentation

About This Presentation
Title:

??????? (Wrapper)

Description:

C# http://www.devbg.org/patternscourse/ (Wrapper) stephan.zahariev[at]gmail.com – PowerPoint PPT presentation

Number of Views:78
Avg rating:3.0/5.0
Slides: 19
Provided by: Stepha262
Learn more at: https://www.devbg.org
Category:

less

Transcript and Presenter's Notes

Title: ??????? (Wrapper)


1
???????(Wrapper)
??????? ???????? ??? C
  • http//www.devbg.org/patternscourse/

?????? ????????
stephan.zaharievatgmail.com
NearSoft Europe www.nearsoft.ch
2
?????????? ??????
  • ?????? ???????? ?? ????? C
  • ???????? ?? ???
  • ?????? ???????? ?? UML (???? ????????)

3
??????????
  • ???????? ?? ???????
  • ???????
  • ????????? ?? ???????
  • ???????? ??????????
  • ????????????
  • ??????? ??? ????????????
  • ?? ? ?????? ???????
  • ??????????

4
???????? ?? ???????
  • ????????? ???????? ?? ?????????????? ??? ?????
    ?????
  • ???????????????? ?? ?????? ???? ??? ??????, ??
    ??? ?? ??????? ?? ????
  • ???????? ???????????? ??????????? ?? ???????????
    ?? ?????????? ??? ??????????? ?? ????????????????
  • ?????? ? ??? ???? ????????? (Decorator)

5
???????
  • ???? ?? ?? ??????? ?? ???????????
    ????????????????? ???????
  • ????????? ?????? ?? ??? ????????, ????? ???????
    ?????
  • ?????????, ????? ??????? ????? ?????? ?? ???
    ?????????? ?? ???? ???????? ? ?????
  • ??? ?????? ?????? ????? ?????????, ?????? ??
    ????? ?????????? ?? ?????????? ? ????

6
??? ?? ??????????? ?????????
  • ????????? ???????? ???????

?? ??????? ????
7
????????? ?? ???????
8
???? ?? ?????????
  • Component
  • ????? ????, ??????????? ??? ?????????
  • BorderWrapper
  • ???????, ????? ????????? ?????
  • ScrollWrapper
  • ???????, ????? ????????? ??????????
  • TextView
  • ????????? ??????? ????????

9
???????? ??????????
abstract class Component public abstract
void Draw() class TextView Component
public override void Draw()
Console.WriteLine("TextView.Draw()")
(???????? ??????????)
10
???????? ??????????
class ScrollDecorator Component private
Component decoratedComponent public
ScrollDecorator(Component component)
decoratedComponent component
public override void Draw()
Console.WriteLine("ScrollDecorator.Draw()")
decoratedComponent.Draw()
(???????? ??????????)
11
???????? ??????????
class BorderDecorator Component private
Component decoratedComponent public
BorderDecorator(Component component)
decoratedComponent component
public override void Draw()
Console.WriteLine("BorderDecorator.Draw()")
decoratedComponent.Draw()
(???????? ??????????)
12
???????? ??????????
static void Main(string args) TextView
text new TextView() ScrollDecorator scroll
new ScrollDecorator(text)
BorderDecorator border new
BorderDecorator(scroll) Component component
border component.Draw() ???????? Bord
erDecorator.Draw() ScrollDecorator.Draw() TextView
.Draw()
13
???????????? 1
  • ?????????? ?? ??????? ??????? ? ?????????????????
    ???????

14
??????? ??? ????????????
  • ?????????? ?? ??????????? ????? ?????? ??
    ???????? ?? ??????????, ????? ??????????
  • ??????????? ?????????? ?? ????? Component ???,
    ?????? ??????????? ?? ???? ????? ??????
  • ??? ?????????? ?? ????? Component ? ?????,
    ????????? ?? ??????????? ?? ??????? ?????????

15
?? ? ?????? ???????
  • ??????????
  • ?????????? ?????????? ?? ?????????
    ??????/???????? ?? ??????????
  • ??????????? ?? ?????????? ? ??-??????? ??????
    ?????????????
  • ??????? ?????????????? ?? ????????? ? ????????? ?
    ????????? ??????????????
  • ???????????
  • ?? ?????? ????? ?? ???????, ????????? ? ???????
    ????????? ?? ?? ?????????
  • ??????????? ????????? ?? ??????? ??????? ???? ??
    ?????? ?? ????????? ????? ???????
  • ?????? ???????????? ???????? ??????
  • ?????????? ?????????

16
??????? (Wrapper)
  • ????????

17
??????????
  • ???? ?? ??????? ??????? ????????
  • ????? ? ?????? ?? ????? ?? ????????? ????????? ?
    ????????
  • ??? ?? ???????????? ?? ??????????? ?? ???????
    ????????
  • ?? ????? ???????? ?????? ???? ?? ?????? ???????
    ????????

18
?????????? ??????????
  • ???? ????, ?????? ????, ???? ???????, ????
    ????????, ??????? ?? ??????, ????????, 2005, ISBN
    954-685-352-6
  • ?????? ??????, UML. ??????, ????????, 2004, ISDN
    954-685-306-2
Write a Comment
User Comments (0)
About PowerShow.com