亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 018.htm

?? 21天內快速掌握c++語言
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
<P>It is possible that <TT>Condition</TT> objects are passed to the central <TT>Alarm</TT>
object, or that <TT>Condition</TT> objects are subclassed into <TT>Alarm</TT> objects,
which themselves know how to take emergency action. Perhaps there is no central object;
instead there might be sensors, which know how to create <TT>Condition</TT> objects.
Some <TT>Condition</TT> objects would know how to log themselves; others might know
how to contact the police.</P>
<P>A well-designed event-driven system need not have a central coordinator. One can
imagine the sensors all independently receiving and sending message objects to one
another, setting parameters, taking readings, and monitoring the house. When a fault
is detected, an <TT>Alarm</TT> object is created, which logs the problem (by sending
a message to the <TT>Log</TT> object) and takes the appropriate action.
<H4 ALIGN="CENTER"><A NAME="Heading10"></A><FONT COLOR="#000077">Event Loops</FONT></H4>
<P>To simulate such an event-driven system, your program needs to create an event
loop. An event loop is typically an infinite loop such as <TT>while(1)</TT>, which
gets messages from the operating system (mouse clicks, keyboard presses, and so on)
and dispatches them one by one, returning to the loop until an exit condition is
satisfied. Listing 18.1 shows a rudimentary event loop.</P>
<P><A NAME="Heading11"></A><FONT SIZE="4" COLOR="#000077"><B>Listing 18.1. A simple
event loop.</B></FONT></P>
<PRE><FONT COLOR="#0066FF" font style="font-size:10pt">1:     // Listing 18.1
2:
3:     #include &lt;iostream.h&gt;
4:
5:     class Condition
6:     {
7:     public:
8:        Condition() { }
9:        virtual ~Condition() {}
10:       virtual void Log() = 0;
11:    };
12:
13:    class Normal : public Condition
14:    {
15:    public:
16:       Normal() { Log(); }
17:       virtual ~Normal() {}
18:       virtual void Log() { cout &lt;&lt; &quot;Logging normal conditions...\n&quot;; }
19:    };
20:
21:    class Error : public Condition
22:    {
23:    public:
24:       Error() {Log();}
25:       virtual ~Error() {}
26:       virtual void Log() { cout &lt;&lt; &quot;Logging error!\n&quot;; }
27:    };
28:
29:    class Alarm : public Condition
30:    {
31:    public:
32:       Alarm ();
33:       virtual   ~Alarm() {}
34:       virtual void Warn() { cout &lt;&lt; &quot;Warning!\n&quot;; }
35:       virtual void Log() { cout &lt;&lt; &quot;General Alarm log\n&quot;; }
36:       virtual void Call() = 0;
37:
38:    };
39:
40:    Alarm::Alarm()
41:    {
42:        Log();
43:       Warn();
44:    }
45:    class FireAlarm : public Alarm
46:    {
47:    public:
48:       FireAlarm(){Log();};
49:       virtual ~FireAlarm() {}
50:       virtual void Call() { cout&lt;&lt; &quot;Calling Fire Dept.!\n&quot;; }
51:       virtual void Log() { cout &lt;&lt; &quot;Logging fire call.\n&quot;; }
52:    };
53:
54:    int main()
55:    {
56:       int input;
57:       int okay = 1;
58:       Condition * pCondition;
59:       while (okay)
60:       {
61:          cout &lt;&lt; &quot;(0)Quit (1)Normal (2)Fire: &quot;;
62:          cin &gt;&gt; input;
63:          okay = input;
64:          switch (input)
65:          {
66:             case 0: break;
67:             case 1:
68:                pCondition = new Normal;
69:                delete pCondition;
70:                break;
71:             case 2:
72:                pCondition = new FireAlarm;
73:                delete pCondition;
74:                break;
75:             default:
76:                pCondition = new Error;
77:                delete pCondition;
78:                okay = 0;
79:                break;
80:          }
81:       }
82:     return 0;
<TT>83: }</TT></FONT>
<FONT COLOR="#0066FF">
Output: (0)Quit (1)Normal (2)Fire: 1
Logging normal conditions...
(0)Quit (1)Normal (2)Fire: 2
General Alarm log
Warning!
Logging fire call.
(0)Quit (1)Normal (2)Fire: 0
</FONT></PRE>
<P><FONT COLOR="#000077"><B>Analysis:</B></FONT><B> </B>The simple loop created on
lines 59-80 allows the user to enter input simulating a normal report from a sensor
and a report of a fire. Note that the effect of this report is to spawn a <TT>Condition</TT>
object whose constructor calls various member functions.<BR>
<BR>
Calling virtual member functions from a constructor can cause confusing results if
you are not mindful of the order of construction of objects. For example, when the
<TT>FireAlarm</TT> object is created on line 72, the order of construction is <TT>Condition</TT>,
<TT>Alarm</TT>, <TT>FireAlarm</TT>. The <TT>Alarm</TT> constructor calls <TT>Log</TT>,
but it is <TT>Alarm</TT>'s <TT>Log()</TT>, not <TT>FireAlarm</TT>'s, that is invoked,
despite <TT>Log()</TT> being declared virtual. This is because at the time <TT>Alarm</TT>'s
constructor runs, there is no <TT>FireAlarm</TT> object. Later, when <TT>FireAlarm</TT>
itself is constructed, its constructor calls <TT>Log()</TT> again, and this time
<TT>FireAlarm::Log()</TT> is called.
<H3 ALIGN="CENTER"><A NAME="Heading13"></A><FONT COLOR="#000077">PostMaster</FONT></H3>
<P>Here's another problem on which to practice your object-oriented analysis: You
have been hired by Acme Software, Inc., to start a new software project and to hire
a team of C++ programmers to implement your program. Jim Grandiose, vice-president
of new product development, is your new boss. He wants you to design and build PostMaster,
a utility to read electronic mail from various unrelated e-mail providers. The potential
customer is a businessperson who uses more than one e-mail product, for example Interchange,
CompuServe, Prodigy, America Online, Delphi, Internet Mail, Lotus Notes, AppleMail,
cc:Mail, and so forth.</P>
<P>The customer will be able to &quot;teach&quot; PostMaster how to dial up or otherwise
connect to each of the e-mail providers, and PostMaster will get the mail and then
present it in a uniform manner, allowing the customer to organize the mail, reply,
forward letters among services, and so forth.</P>
<P>PostMasterProfessional, to be developed as version 2 of PostMaster, is already
anticipated. It will add an Administrative Assistant mode, which will allow the user
to designate another person to read some or all of the mail, to handle routine correspondence,
and so forth. There is also speculation in the marketing department that an artificial
intelligence component might add the capability for PostMaster to pre-sort and prioritize
the mail based on subject and content 888 and associations.</P>
<P>Other enhancements have been talked about, including the ability to handle not
only mail but discussion groups such as Interchange discussions, CompuServe forums,
Internet newsgroups, and so forth. It is obvious that Acme has great hopes for PostMaster,
and you are under severe time constraints to bring it to market, though you seem
to have a nearly unlimited budget.
<H3 ALIGN="CENTER"><A NAME="Heading14"></A><FONT COLOR="#000077">Measure Twice, Cut
Once</FONT></H3>
<P>You set up your office and order your equipment, and then your first order of
business is to get a good specification for the product. After examining the market,
you decide to recommend that development be focused on a single platform, and you
set out to decide among DOS; UNIX; the Macintosh; and Windows, Windows NT, and OS/2.</P>
<P>You have many painful meetings with Jim Grandiose, and it becomes clear that there
is no right choice, and so you decide to separate the front end, that is the user
interface or UI, from the back end, the communications and database part. To get
things going quickly, you decide to write for DOS first, followed by Win32, the Mac,
and then UNIX and OS/2.</P>
<P>This simple decision has enormous ramifications for your project. It quickly becomes
obvious that you will need a class library or a series of libraries to handle memory
management, the various user interfaces, and perhaps also the communications and
database components.</P>
<P>Mr. Grandiose believes strongly that projects live or die by having one person
with a clear vision, so he asks that you do the initial architectural analysis and
design before hiring any programmers. You set out to analyze the problem.
<H3 ALIGN="CENTER"><A NAME="Heading15"></A><FONT COLOR="#000077">Divide and Conquer</FONT></H3>
<P>It quickly becomes obvious that you really have more than one problem to solve.
You divide the project into these significant sub-projects:
<BR>
<DL>
	<DD><B>1.</B> Communications: the ability for the software to dial into the e-mail
	provider via modem, or to connect over a network.<BR>
	<BR>
	<B>2.</B> Database: the ability to store data and to retrieve it from disk.<BR>
	<BR>
	<B>3.</B> E-mail: the ability to read various e-mail formats and to write new messages
	to each system.<BR>
	<BR>
	<B>4.</B> Editing: providing state-of-the-art editors for the creation and manipulation
	of messages.<BR>
	<BR>
	<B>5.</B> Platform issues: the various UI issues presented by each platform (DOS,
	Macintosh, and so on).<BR>
	<BR>
	<B>6.</B> Extensibility: planning for growth and enhancements.<BR>
	<BR>
	<B>7.</B> Organization and scheduling: managing the various developers and their
	code interdependencies. Each group must devise and publish schedules, and then be
	able to plan accordingly. Senior management and marketing need to know when the product
	will be ready.
</DL>
<BR>
<P>You decide to hire a manager to handle item 7, organization and scheduling. You
then hire senior developers to help you analyze and design, and then to manage the
implementation of the remaining areas. These senior developers will create the following
teams:
<BR>
<DL>
	<DD><B>1.</B> Communications: responsible for both dial-up and network communications.
	They deal with packets, streams, and bits, rather than with e-mail messages per se.<BR>
	<BR>
	<B>2.</B> Message format: responsible for converting messages from each e-mail provider
	to a canonical form (PostMaster standard) and back. It is also their job to write
	these messages to disk and to get them back off the disk as needed.<BR>
	<BR>
	<B>3.</B> Message editors: This group is responsible for the entire UI of the product,
	on each platform. It is their job to ensure that the interface between the back end
	and the front end of the product is sufficiently narrow that extending the product
	to other platforms does not require duplication of code.
</DL>
<BR>
<H3 ALIGN="CENTER"><A NAME="Heading16"></A><FONT COLOR="#000077">Message Format</FONT></H3>
<P>You decide to focus on the message format first, setting aside the issues relating
to communications and user interface. These will follow once you understand more
fully what it is you are dealing with. There is little sense in worrying about how
to present the information to the user until you understand what information you
are dealing with.</P>
<P>An examination of the various e-mail formats reveals that they have many things
in common, despite their various differences. Each e-mail message has a point of
origination, a destination, and a creation date. Nearly all such messages have a
title or subject line and a body which may consist of simple text, rich text (text
with formatting), graphics, and perhaps even sound or other fancy additions. Most
such e-mail services also support attachments, so that users can send programs and
other files.</P>
<P>You confirm your early decision that you will read each mail message out of its
original format and into PostMaster format. This way you will only have to store
one record format, and writing to and reading from the disk will be simplified. You
also decide to separate the &quot;header&quot; information (sender, recipient, date,
title, and so on) from the body of the message. Often the user will want to scan
the headers without necessarily reading the contents of all the messages. You anticipate
that a time may come when users will want to download only the headers from the message
provider, without getting the text at all, but for now you intend that version 1
of PostMaster will always get the full message, although it may not display it to
the user.
<H3 ALIGN="CENTER"><A NAME="Heading17"></A><FONT COLOR="#000077">Initial Class Design</FONT></H3>
<P>This analysis of the messages leads you to design the <TT>Message</TT> class.
In anticipation of extending the program to non-e-mail messages, you derive <TT>EmailMessage</TT>
from the abstract base <TT>Message</TT>. From <TT>EmailMessage</TT> you derive <TT>PostMasterMessage</TT>,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人综合视频| 国产sm精品调教视频网站| 精品午夜一区二区三区在线观看| 国产成人综合视频| 欧美乱妇20p| 亚洲特级片在线| 国产伦精品一区二区三区免费迷 | 天天影视网天天综合色在线播放| 精品一区二区三区香蕉蜜桃| 欧美在线一区二区三区| 国产精品久久久久久久久图文区| 久久精品噜噜噜成人88aⅴ| 欧美性猛片aaaaaaa做受| 中文字幕一区二区不卡| 国产美女一区二区| 精品国产三级电影在线观看| 婷婷激情综合网| 欧美日韩一区不卡| 一区二区三区美女视频| 色综合久久综合网97色综合 | 91精品欧美久久久久久动漫 | 亚洲欧美自拍偷拍| 国产成人高清在线| 久久久久久久精| 国产老女人精品毛片久久| 精品久久99ma| 国内成+人亚洲+欧美+综合在线| 日韩小视频在线观看专区| 视频一区视频二区中文| 欧美精品免费视频| 视频在线观看91| 日韩欧美在线123| 青青草国产成人av片免费| 91 com成人网| 老司机精品视频在线| 日韩欧美一级片| 国产一区二区三区免费在线观看| 亚洲精品一区二区三区99| 精品一二三四在线| 国产亚洲欧美一级| 成人成人成人在线视频| 亚洲欧美在线aaa| 91成人网在线| 蜜桃视频在线观看一区| 2023国产精品| 91香蕉视频mp4| 亚洲图片欧美一区| 精品久久久久久久久久久院品网| 国产成人午夜电影网| 国产精品久久久久久妇女6080| 色综合久久中文综合久久97| 亚洲国产乱码最新视频| 欧美一区二区观看视频| 国产精品99久| 亚洲精品日韩综合观看成人91| 欧美日韩视频在线一区二区| 久久国产视频网| 国产精品毛片久久久久久久| 欧美色图在线观看| 国产在线精品一区二区不卡了 | 久久亚洲春色中文字幕久久久| 成人免费视频国产在线观看| 亚洲自拍另类综合| 久久综合色一综合色88| 色综合久久久久久久久| 免费高清视频精品| 中文字幕在线不卡一区| 欧美一区二区性放荡片| 成人免费毛片aaaaa**| 手机精品视频在线观看| 欧美激情资源网| 7777精品伊人久久久大香线蕉超级流畅 | 色综合色综合色综合 | 播五月开心婷婷综合| 亚洲v日本v欧美v久久精品| 国产欧美精品区一区二区三区 | 色一区在线观看| 久久er99精品| 亚洲午夜久久久| 国产日韩精品一区二区三区 | 在线观看成人小视频| 国产一区欧美日韩| 亚洲成人免费看| 中文字幕日韩精品一区| 久久综合av免费| 91精品国产综合久久久久久久久久 | 欧美一级欧美三级在线观看| 99久久国产综合精品女不卡| 国产一区二区三区久久久| 亚洲va国产va欧美va观看| 综合在线观看色| 日本一区二区不卡视频| 久久综合九色综合97_久久久| 欧美精品在线一区二区三区| 99精品视频一区二区三区| 国产精品一二三区在线| 麻豆精品久久久| 日韩av电影免费观看高清完整版 | 日韩福利电影在线| 一区二区三区精品视频| 亚洲视频你懂的| 国产精品久久久久久久第一福利| 久久久久久久一区| 久久五月婷婷丁香社区| 56国语精品自产拍在线观看| 欧美片在线播放| 欧美日韩国产精选| 欧美色综合影院| 欧美日韩夫妻久久| 欧美精品乱码久久久久久| 91看片淫黄大片一级在线观看| 成人动漫一区二区| av在线播放不卡| 一本色道久久综合精品竹菊| 91麻豆国产香蕉久久精品| 色婷婷综合在线| 日本二三区不卡| 欧美在线免费播放| 欧美视频在线播放| 91精品国产一区二区三区| 日韩精品一区二区三区在线观看| 欧美一级二级三级蜜桃| 精品久久久久久无| 国产日韩精品一区二区三区 | 国产婷婷一区二区| 亚洲精品一区二区三区香蕉| 欧美亚洲丝袜传媒另类| 成人听书哪个软件好| 国产麻豆精品一区二区| 国产精品久久久久久久蜜臀| 欧美经典三级视频一区二区三区| 中文字幕av一区 二区| 亚洲免费在线视频一区 二区| 伊人婷婷欧美激情| 婷婷久久综合九色国产成人| 麻豆精品久久精品色综合| 国产成人亚洲综合色影视| 99久久国产综合精品色伊| 欧美三级资源在线| 精品久久久久久无| 日韩久久一区二区| 日日夜夜免费精品视频| 国内不卡的二区三区中文字幕| 成人激情动漫在线观看| 精品视频全国免费看| 精品黑人一区二区三区久久 | 精品国产麻豆免费人成网站| 中文字幕精品—区二区四季| 成人精品小蝌蚪| 成人18精品视频| 久久久影院官网| 欧美一区二区视频观看视频| 精品国内二区三区| 亚洲色图另类专区| 另类小说图片综合网| kk眼镜猥琐国模调教系列一区二区| 欧美丝袜丝交足nylons图片| 久久亚洲一区二区三区四区| 亚洲国产aⅴ成人精品无吗| 久久国产综合精品| 色综合久久综合网97色综合| 精品国产免费一区二区三区香蕉| 亚洲欧美怡红院| 精品亚洲成av人在线观看| 欧美三区在线观看| 国产精品毛片无遮挡高清| 狠狠色伊人亚洲综合成人| 精品视频123区在线观看| 亚洲欧洲日韩女同| 国产剧情av麻豆香蕉精品| 3d动漫精品啪啪一区二区竹菊| 亚洲视频在线观看一区| 国产麻豆精品久久一二三| 欧美日韩国产首页| 亚洲视频在线一区| 欧美午夜影院一区| 成人av在线播放网址| 亚洲欧美一区二区不卡| 国精品**一区二区三区在线蜜桃| 91久久精品一区二区三| 国产精品欧美经典| 精品中文字幕一区二区小辣椒| 色一情一乱一乱一91av| 亚洲国产精品成人综合| 国产乱子轮精品视频| 精品国产第一区二区三区观看体验| 午夜欧美在线一二页| 一本久久a久久精品亚洲| 欧美激情中文不卡| 高清不卡在线观看av| 久久一留热品黄| 韩国三级中文字幕hd久久精品| 欧美一区二区福利在线| 日韩电影在线观看一区| 欧美揉bbbbb揉bbbbb| 亚洲国产精品久久人人爱 | 日本精品一区二区三区高清| 中文字幕在线不卡国产视频| av在线不卡网| 亚洲精品菠萝久久久久久久|