<?xml version="1.0" encoding="gb2312"?>

<!-- RSS generated by oioj.net on 4/16/2004 ; 感谢LeXRus提供 RSS 2.0 文档; 此文件可自由使用，但请保留此行信息 --> 
<!-- Source download URL: http://blogger.org.cn/blog/rss2.asp       -->
<rss version="2.0">

<channel>
<title>Natural Pink</title>
<link>http://blogger.org.cn/blog/blog.asp?name=莹莹</link>
<description>莹莹的博客</description>
<copyright>blogger.org.cn</copyright>
<generator>W3CHINA Blog</generator>
<webMaster>webmaster@blogger.org.cn</webMaster>
<item>
<title><![CDATA[大起大落]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17975</link>
<author>莹莹</author>
<pubDate>2006/8/31 21:39:06</pubDate>
<description><![CDATA[
<P><A><FONT size=5>　</FONT></A><FONT size=4>老天你对不住我<IMG src="http://blogger.org.cn/blog/images/emot/face13.gif">，从一个云端跌到另一个云端！有点不能接受。</FONT></P>
<P><FONT size=4>&nbsp;&nbsp; 大学同寝的女孩a说刚刚和相恋三年的朋友分手了，现在有两个男孩在追他，其实很早以前我就预感到了，她在围城的里面，应该全然不知吧？我知道她的伤心，可也为它高兴，又有了全新的开始，就像生命轮回迎来了又一个春天，不知道这个春天于她是春雨绵绵还是春阳灿灿?</FONT></P>
<P><FONT size=4>&nbsp;&nbsp; a说她哭了几天现在已经好了，毕竟是天蝎座的，很容易淡忘的。qq里语言仿佛很欢快，我真的有点佩服她，那么坚强，不过连续不断蹦出来的“靠！”还是让我的心格外难受，她说好想我们，其实我也好想她们啊，也许在一起，可以给她臂膀，让她哭泣，像我们曾经在一起欢笑过一样。</FONT></P>
<P><FONT size=4>&nbsp;&nbsp; a说b年底要订婚了，大学的时候她常常跟我们说她想和男友偷偷去领证，可是他不肯。</FONT></P>
<P><FONT size=4>&nbsp;&nbsp; b是我们寝最小的小姑娘，长得小巧可爱，看起来像个初中的小学生。而如今她就要订婚了，不敢想她怎样成为一个少妇，一个母亲。</FONT></P>
<P><FONT size=4>&nbsp;&nbsp; 老天我受不了了！什么世道，怎么这样啊？</FONT></P>
<P><FONT size=4>&nbsp;&nbsp; 我还是一个离这些词很遥远的傻瓜！听着有种恍恍惚惚的感觉，不敢想像这些词加到自己身上是什么感觉，真希望时间能停止，让我们一直就这样过下去。</FONT></P>
<P><FONT size=4>&nbsp;&nbsp; 发誓一辈子只谈恋爱，我有结婚恐惧症啊！救救我吧！<IMG src="http://blogger.org.cn/blog/images/emot/face9.gif"></FONT></P>]]></description>
</item><item>
<title><![CDATA[他的来信]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17973</link>
<author>莹莹</author>
<pubDate>2006/8/31 21:23:10</pubDate>
<description><![CDATA[
<DIV>
<DIV><FONT size=4>乖乖！</FONT></DIV>
<DIV><FONT size=4>&nbsp;&nbsp;&nbsp; 你怎么弄弄就没有音迅了，我怎么联系你都联系不上，在这能不着急么？你要是联系不上我，是不是一点感觉都没有啊！！上回你就是停了好长时间，完了我搬家手机一直没电，联系不上你，我就好着急，又给你打电话什么的，就你不着急是不是？真是气死我了@（^-^）@。</FONT></DIV>
<DIV><FONT size=4>&nbsp;&nbsp;&nbsp; 看看哪天我要是跟你一样没消息你是什么反映，能有我这么着急生气么？我想应该不会吧！！对不对，没心没肺的家伙，你就是不会为乖乖想想，是不是啊！</FONT></DIV>
<DIV><FONT size=4>&nbsp;&nbsp;&nbsp; 今天真是把我气死了，你知道么？早上九点我给你打电话你关机，我以为你可能还没有起床呢！过了十点我又给你打电话，还是关机呢，再过了半个小时我又打，还是关机呢！！差不多到12电之前，没有15分钟我就打了一回，让我好失望啊！等到了两点、三点，没有一会儿我就打，可一直是关机，你说我能不急么？一天你放假没理由没有时间去交话费么，怎么到了下午还没开机，你是不是不想跟我联系了啊？就今天我给你打的电话不只有50多个了，要是我停机或怎么了你能给我打多少个啊！！</FONT></DIV>
<DIV><FONT size=4>&nbsp;&nbsp; 到了几点钟了，给你打电话你终于开机了，那我还打了3个电话，你不但都没接，连一条信息都没回我，等到了你回去了说什么：“就是我生气了也不管了先睡上一觉，好累。”连干什么去都没告诉我，再就没动静了，我着急生气，你看了短信也应该知道吧1是不是啊，乖乖！结果还是把我仍在一边。别说我有多生气了。</FONT></DIV>
<DIV><FONT size=4>&nbsp;&nbsp;&nbsp; 给你打电话，你说出去逛街了，累到那样了么，不管我是生气还是不高兴了，再说你昨天先给我打个电话多好啊！我联系不上你好着急呢！！</FONT></DIV>
<DIV><FONT size=4>你都不知道，三天都没消息你是不是一点都不着急啊！恩~~~~~</FONT></DIV>
<DIV><FONT size=4>&nbsp;&nbsp;&nbsp; 说你不跟我联系你还烦，恩--干什么不耐烦的说：“不说了”我是不是让你好烦啊，气的我把手机都想给摔了，好郁闷！你就想着自己逛街累，没时间，我能知道你在逛街么，三天都没信息，说你不跟我联系你还急，真----，关机，你是不是好委屈啊！我追着说你为了什么啊？那要是你十几天都没信息，我都什么不追你问好不好，你会觉得很正常很舒服么？</FONT></DIV>
<DIV><FONT size=4>&nbsp;&nbsp;&nbsp; 过来这么长时间你主动给我打过一回电话了没？？你就没有想乖乖的时候么？我真是有点想不通你，都和你说了好多什么感情不要老放在心底，不表达出来。我是什么都不知道的。恩-----</FONT></DIV>
<DIV><FONT size=4>&nbsp;&nbsp;&nbsp; 跟你真是说什么都没有用了-----</FONT></DIV>
<DIV><FONT size=4>&nbsp;&nbsp;&nbsp; 别给我回信了，有时间给我发信息，我着不是在公司给你发的邮件，在外面的网吧里，上网好贵的3.5一小时呢，我们下周一要有机器了还要认师父呢！！</FONT></DIV>
<DIV><FONT size=4>&nbsp;&nbsp;&nbsp; 不说了，下回在有这样的事情发生我绝对一周不理你，知道么？？</FONT></DIV>
<DIV><FONT size=4>&nbsp;&nbsp;&nbsp; 哼哼哼哼哼哼哼哼哼哼哼哼！</FONT></DIV>
<DIV><FONT size=4>&nbsp;</FONT></DIV>
<DIV><FONT size=4>&nbsp;</FONT></DIV>
<DIV><FONT size=4>&nbsp;&nbsp; 有一点心酸，自己总是这样马马虎虎，大大咧咧的，让他着急，伤心。他是一个很好很好的男孩子，很疼惜我，上天真的很眷顾我，让我遇到他，享有他无边的爱。我不能再像一个长不大的小孩子一样，任意挥霍他给的爱，真怕有一天他觉得倦了，离开我，要学着长大，给他更多温柔的眷恋和体贴，让他安心。</FONT></DIV></DIV>]]></description>
</item><item>
<title><![CDATA[伤逝]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17924</link>
<author>莹莹</author>
<pubDate>2006/8/30 9:51:16</pubDate>
<description><![CDATA[
<P>&nbsp;&nbsp;总是怀念过去，平平淡淡三点一线的生活，那个潮湿的季节，那些雨里的丁香。</P>
<P>&nbsp; 那些单纯的过往，会在我的怀念里慢慢淡忘吗？</P>
<P>&nbsp; 我不停的寻找，阅读，玩味，惆怅那些校园里清涩的心情，喜欢那些唯美的带有樱花颜色，夸张绚丽的插图。总是觉得自己是一个有唯美主义倾向的人，而在现实中却是多么平凡又平凡的芸芸众生中的一个啊！</P>
<P>&nbsp; 我常常阅读郭敬明，他应该是一个喜欢安静，依恋寂寞，享受伤感的人吧？只是当那些美好的青春，都逝去，逝去的时候，那于他该是怎样的痛苦，他要怎样生活？我不敢想，就像我不敢去想自己将要面对的生活一样。</P>
<P>借他的文字来祭奠我逝去的青春。</P>
<P>&nbsp; 我的生活一如既往，很多的朋友，很明亮的生活，只是越来越深信一句话，越是明亮的地方，越是会产生最暗的阴影。<BR>&nbsp;&nbsp;&nbsp;生活突然进入一种忙碌的节奏，每个周末会往全国各个地方飞。我的耳朵突然开始习惯飞机起飞、降落时巨大的轰鸣声，习惯飞机上难吃的饭，习惯躺在九千米的高空做白日梦。<BR>&nbsp;&nbsp;&nbsp;以前我曾经许愿，我说以后我要走很多的路，看很多的风景，我要把曾经在地图上看过的地方真实地踩在脚底下。而如今，我真的是走了很多的地方了，以前没去过的现在都去了。我想我应该可以释然了。可是为什么心里还是有难过？<BR><BR>&nbsp;&nbsp;&nbsp;　我在上海，悠闲地生活，学着编导方面的东西，期望着有天我可以拍出让人泪流满面的作品。空闲的时候我会去图书馆，在一排一排长长的书架里找那些厚厚的落满尘埃的专业书。看怎么调度场景，看怎么布置灯光。图书馆有很多巨大的玻璃窗，望出去，是不断起落的飞鸟。有时候我闭着眼睛就开始想像那些飞鸟落下的浅灰色的羽毛轻轻地覆盖在我的瞳仁上&nbsp;，于是我想起小A的浅灰色的瞳仁。想起那棵在我记忆里面一直飘零的樱花树。在明亮的阳光里，不停伤逝。<BR>&nbsp;&nbsp;&nbsp;有时候在宿舍下面的凉亭里吃西瓜，蹲在栏杆上，几个朋友在那里随便地说话，讲一些无关痛痒的话，做一些可有可无的表情，于是我想日子就这么过了。<BR><BR>&nbsp;&nbsp;&nbsp;然后突然想起项斯微说过的话：我总是在我的十八岁缅怀我的十七岁，而在我十九岁的时候又会缅怀我的十八岁。<BR><BR>　想起鲁迅说过的：这样的生活何时才是个尽头啊。</P>
<P>&nbsp; 我总是喜欢站在草坪上举目向东看，一直向东，向东。&nbsp;<BR>&nbsp;&nbsp;我想看看东京塔的雾气，散了没有。<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;我总是喜欢站在楼顶上举目向西看，一直向西，向西，我想看看家乡的向日葵，开了没有。<BR>&nbsp;&nbsp;我已经忘记了乘火车的感觉，一直坐飞机坐到自己想吐。<BR>&nbsp;&nbsp;记得以前高中的时候，我和小A总是在火车上，裹着毯子安静地睡去。睡不着的晚上就靠着窗看外面山脉黑色模糊的轮廓，偶尔散落在山脚下的昏黄的灯火，或者飞逝而过的灰铁站牌。天亮的时候会抬头望天，想着那些移动的云朵是否会拼凑出一张记忆深处的面容，一瞬间可以让我丧失所有的语言。仓皇的。伤感的。田野里有飞鸟扑扇着翅膀冲上高高的苍穹。<BR>&nbsp;&nbsp;&nbsp;年少的梦想清澈得如同湖泊一样，曾经的纯真和对生活的坚持。握着咖啡杯都可以想像掌心开出一朵花，香味弥漫如同最美的藤蔓植物。学陶艺的时候整天和泥巴打交道，感觉泥土在指间百转千回。<BR><BR>&nbsp;&nbsp;&nbsp;学插花的时候和同桌的女生畅想以后自己的恋人，她说她的白马王子会在厨房里摆满小小的仙人掌，煲汤的时候会捧一本画册安静地等待。我说我的白雪公主会在屋顶花园里种满金黄色的向日葵，穿着白色的棉布裙子为它们浇水。说完后我就笑了，因为我突然想起在刚刚过去的夏天，我就是穿着白色的棉布T恤米色的粗布裤子，在我家的屋顶上种满了向日葵。<BR>&nbsp;&nbsp;&nbsp;&nbsp;而如今，我只能在楼顶上仰望长满云朵的天空。我突然想起金城武，想起《心动》里面他总是躺在屋顶天台上，望着灰色的蓝色的白色的晴朗的阴霾的天空，然后拍照片，一盒子的照片，然后送给她，告诉她，这是我想你的时候的天空。<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;我站在高高的屋顶上，风破空而来，我伸出手挡着眼前的沙尘，当风快要离开的时候，我总是会对它讲，你可不可以帮我看看，我家乡屋顶上的向日葵，开了没有，死了没有，有人为它们浇水没有？<BR>&nbsp;&nbsp;东邪西毒》。时间的灰烬。西毒讲，我想回去看看，家乡的桃花，开了没有。<BR><BR>&nbsp;&nbsp;那些素面朝天的城市，那些洗尽铅华的容颜，在我的飞机起飞的时候，就全部沦陷了。<BR><BR>　　言情剧里总是有人煽情地说，亲爱的，再见了，再见了。我们总是笑着说虚伪。<BR><BR>&nbsp;&nbsp;&nbsp;可是我终于发现，我们认真说过再见的人，再见的事，永远都不能再见了。<BR><BR>　　你选择往东，那么我就固执地往西走。从今以后，有着不同的境遇，各自辗转在不同的命运里，各自匍匐在不同的伤痕中。当飞机把我们的回忆带上九千米的高空，当火车轰隆隆地碾碎我们明媚的青春，我是那么难过地，难过地，哭了。</P>
<P>&nbsp;&nbsp;&nbsp; 原谅我凌乱的文字，原谅我破碎的时光。<BR><BR></P>
<P>&nbsp;</P>]]></description>
</item><item>
<title><![CDATA[wi_fi]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17921</link>
<author>莹莹</author>
<pubDate>2006/8/30 9:41:50</pubDate>
<description><![CDATA[
<TABLE width="72%" bgColor=#ffffff border=0>
<TBODY>
<TR>
<TD class=p14 align=left>&nbsp;</TD></TR>
<TR>
<TD></TD>
<TD class=f14 align=left width="97%">
<TABLE style="TABLE-LAYOUT: fixed; WORD-WRAP: break-word" cellSpacing=0 cellPadding=0 width="87%" border=0>
<TBODY>
<TR>
<TD class=gray14>Wi-Fi&nbsp;Wireless&nbsp;Fi-delity <BR><BR><BR><BR>Wi-Fi原是无线高传真的缩写，现被视为802.11无线局域网络的代名词。Wi-Fi技术规格为IEEE提出，经Wi-Fi联盟认证后，可确保不同无线产品的互通。&nbsp; <BR><BR><BR><BR>1996年，美国网络通讯设备大厂朗讯（Lucent）率先发起成立无线以太兼容性联盟（Wireless&nbsp;Ethernet&nbsp;Compatibility&nbsp;Alliance，WECA），着手创立无线网络协议（WLAN），发展起初发展不顺，声势远落蓝芽（Blue-tooth）之后。1999年，WECA更名为Wi-Fi联盟，再度架构一套认证标准，提出通行业界的无线网络技术--802.11一系列规格，包括802.11.b、802.11.a、802.11.等。&nbsp; <BR><BR><BR><BR>Wi-Fi作为802.11b的昵称，与以太网络作为IEEE&nbsp;802.3的昵称道理一样。现阶段，经过Wi-Fi联盟兼容性测试的无线网络产品，即使制造商不同，也可互通与兼容，如PCMCIA无线网卡、USB无线模块等。根据Wi-Fi联盟数据显示，自2000年联盟开始进行认证以来，目前约有680项产品已获得Wi-Fi认证，预估2003年底认证产品将超越千项。&nbsp; <BR><BR><BR><BR>目前，Wi-Fi联盟正大力推动Wi-Fi&nbsp;Zone计划，准备将Wi-Fi认证标志延伸至提供公众无线网络服务的热点（Hpt&nbsp;Spot）应用。该联盟也公布未来标准的认证时程，如针对无线传输安全性的WPA（Wi-Fi&nbsp;Protected&nbsp;Access）V2，也就是802.11i将于2004年第3季通过认证；而可提供VoIP及强化多媒体支持的802.11e，也同样计划在2004第3季通过Wi-Fi认证。 <BR></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD height=17></TD></TR></TBODY></TABLE>]]></description>
</item><item>
<title><![CDATA[不想说毕业]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17287</link>
<author>莹莹</author>
<pubDate>2006/8/7 19:41:53</pubDate>
<description><![CDATA[
<P>&nbsp; 时间过得真快啊，转眼大学毕业了！每每在心里对自己说这句话的时候，总有一种虚虚的很惶恐的感觉，好像小时候一直陪在身边的布娃娃莫名其妙不见了，四处寻找都找不到，可又不相信真的找不到了，于是不知所措四处张望！</P>
<P>&nbsp;&nbsp; 真的就这样我再也回不到过去了吗，那些过往的青春，单纯美好的日子都从我的世界里悄无声息的一瞬间溜走了吗？眼睛里不禁泛起了涟漪。</P>
<P>&nbsp;&nbsp; 这里是我现在的生活，**电子苏州有限公司。</P>
<P>&nbsp;&nbsp; 记得还是在几个月前，我对“公司”“白领”这样的字眼还有一种莫名的感觉，仿佛离我还是很遥远很神圣的的东西，脑子里有高高的写字楼和美丽的女性的影子在疯长，就像别人说苏州的时候，我的脑子里就会生出蒙蒙烟雨，小巷，丁香油纸伞一样的画面。现在我已经是“公司”的“白领”了，而且是在苏州，但这些词在我的心里失去了它本来的光华，说出来的时候就和说土豆，白菜一样没有任何感觉。</P>
<P>&nbsp;&nbsp;&nbsp; 我们的公司位于苏州火车站以北，在苏州市地图上，最北的边缘，仔细看才能看出我们公司所在的相城区，差一点这张大大的地图上就没有它的容身之处了，以我们的话说就是在一个差一点就鸟不拉屎的地方。公司占地几百平方米，方方正正像个棋盘，棋盘中央有三幢楼房，两幢两层的是厂房，一幢三层的还没有投入使用，还有一幢靠着最东边围墙的五层楼是所有员工的宿舍楼，楼周围两步见方的草坪显示着这里是并非是鸟不拉屎的地方，除此之外还有四通八达的水泥大道,孤单的篮球场，剩下的便是大片大片暂时还荒废的土地，在七月眩晕的阳光里和充足的水份滋润下疯长出满地的野草，有的足足高出我一头多。这让我想起了我的小学时代，在某个黄昏不小心被独自锁在校园里，仿佛也是也看到一样的棋盘，一样的围墙，一样安静的矮房。</P>
<P>&nbsp;&nbsp;&nbsp; 我工作的地方在一幢两层楼的一楼，一个大大白璧的办公室，一边墙上是大大的窗，灰白色的百折窗帘，因为用电脑的缘故一直都没有拉开过。三四十个人，填在蓝色的格子里，一桌，一椅，一点脑。很多时候这样的地方都让人觉得是在教室，或者某个机房，仿佛我们不曾离开校园。记得刚来还没有多久，每每当下班的音乐声响起来的时候，岩岩总会说：“放学了，走吧，吃饭去！”我就指着她开始一阵狂笑，“傻瓜，是下班！”。</P>
<P>&nbsp;&nbsp; 我们这里的人都来自祖国的大江南北。岩岩在西安读大学，家在河北，一张圆圆的娃娃脸，还不及肩的马尾，随着她的笑声在转身投足之间欢快的晃来晃去。她是个有白痴一样笑容的小女孩，因为上学早，要比我们同级上学的孩子小两三岁，她总为班里的同学叫她小朋友而眉毛蹙起来，认真地问：“太过分了，他们总叫我小朋友，我有那么小吗？”我通常不说话，一直看着她就想笑，笑弯了腰，她迷惑的看看我，一屁股坐在床上，拿起面包，饼干或者沙琪马之类的东西就开吃了，吃东西也没能塞住她的嘴，一些乱其八糟的形容词，莫名其妙的笑声不停的从她嘴里冒出来。她就是这样子，只要吃东西的时候就特别兴奋，好像注射了兴奋剂一样，边吃边说边比划，从来也不为快要超标的体重而发愁。</P>
<P>&nbsp;&nbsp;&nbsp; 这里的夜晚总是凉风习习，我喜欢在这样的夜晚，听一首歌，看月亮，伴着耳边的虫鸣，意识慢慢飘缈起来。最近总听那一首twins&lt;&lt;瓶中沙&gt;&gt;,</P>
<P>树梢的枝桠，开满凤凰花<BR>问你知道吗，成长要代价<BR>风雨在敲打，我放心不下<BR>去年的嫩芽，又怎能无暇<BR><BR>亲爱的朋友，与你共渡的年华<BR>让我的回忆很潇洒</P>
<P><FONT color=#e10900>瓶中沙</FONT>装的话<BR>我用笔写下<BR>海风刮竹篱笆<BR>我们埋下它<BR><FONT style="COLOR: #e10900">瓶中沙</FONT>写的话<BR>问你是否还牵挂<BR>那张年轻熟悉的脸颊<BR>留长的发<BR>逃离过的家</P>
<P>四季在变化<BR>秋冬又春夏<BR>问你知道吗<BR>年少在尴尬<BR>说过的笑话<BR>曾经吵的架<BR>我们牢记它<BR>友谊在长大<BR><BR>让青春喧哗<BR>我们大声的表达<BR>将未来的地图重画<BR><BR><FONT style="COLOR: #e10900">瓶中沙</FONT>装的话<BR>我用笔写下<BR>海风刮竹篱笆<BR>我们埋下它<BR><FONT style="COLOR: #e10900">瓶中沙</FONT>写的话<BR>问你是否还牵挂<BR>那张年轻熟悉的脸颊<BR><BR><FONT style="COLOR: #e10900">瓶中沙</FONT>装的话<BR>我用笔写下<BR>海风刮竹篱笆<BR>我们埋下它<BR><FONT style="COLOR: #e10900">瓶中沙</FONT>写的话<BR>问你是否还牵挂<BR>那张年轻熟悉的脸颊<BR>留长的发<BR>逃离过的家<BR><BR>记得多年后的下午茶<BR>我们约好要一起喝下<BR><BR><BR></P>]]></description>
</item><item>
<title><![CDATA[微微疼痛]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17176</link>
<author>莹莹</author>
<pubDate>2006/8/4 13:22:39</pubDate>
<description><![CDATA[
<P>收藏自榕树下《微微疼痛》</P>
<P>&nbsp; 你收到我的信，然后放在某个角落。无聊的时候你或者想起了这个等待着你开启的信封，于是你随意地给信纸撕开了个口子。眼睛先是往瞧瞧，发现了这张精致的信纸。你想或许又是哪个花痴的女生给你写了些花痴的文字表扬你的忧伤。你打开了信纸，小心翼翼地翻起那些由我细心编织的折痕，终于你看到以上的文字，那些我写给你的开场白。 <BR>　　你经常说些自以为让人觉得颓废的关于忧伤的句子。你说他们终究不会热情地喜欢上个用文字记述忧伤的男生。或许你没有在阳光下面接受体育有关挥汗如雨的历练，貌似总是弱不禁风地叨念着自己的文字，但或许这样平淡的忧伤会让某些人感觉舒适。或许我就是某些人里面的某个，某个不单喜欢你文字的女生。 <BR>　　这里浮躁的空气里会常有你的影子,尽管你总会是那么的安静。安静的文字被安静的你收敛起了更多的浮华，我独自坐在某个角落里靠着窗口斜射入的光线读着你熹微安详的文字。华丽的辞藻仿佛是在竭力地安抚着关于青春的隐隐痛楚。习惯看着你用很少的笔迹描摹微笑的表情，习惯看着你笔尖滑动而弯曲的每个弧线，每个记述忧伤的点滴文字。你没有让忧伤泛滥成河，却足以掠走我的泪水，没有那么多的情节却足够让我们彼此忧郁地悲伤。或许是什么遮挡住了你的双眼，封闭了明媚的阳光，或者我又那么钟爱着关于痛楚的文字，那么多的华丽辞藻铺垫而成的华丽句子，那么多的关于你的笔迹。 <BR>　　我想了很久给你写这封简短的书信。我会担心我的文字不会有那么多的修辞而让你懒于阅读，我会担心你会不屑于我的幼稚情感而懒于提笔给我回信，我会担心你会在某个时候不再抒写我们彼此的忧伤而饱和满让你有些难过的锋芒。 <BR>　　我们微笑然后继续征途。黑夜那么多殷实的际遇，包裹忧伤，包裹着忧伤里面的我们。黑夜里的征途攀爬满黑色的荆棘，我们各自安抚着忧伤，各自渲染着凄凉，文字由最后的那个句号停止，天空里的黑色突兀地冒出了道白色的光芒，或许长夜里的故事已经快要结束，而天空即将像你的名字那样即将明朗。</P>
<P>&nbsp; 我是在某个午后开启这封来信，发现娟秀的字体和几个精致的卡通娃娃。整个下午恐怕都会沉浸着你给予我的快乐里面。我没有急于回信，只是反复地看着你漂亮的字体及我们共同拥有的忧伤。我似乎不知道从何提笔介入我们的这次对话，就好像某个习惯忧伤的人不知道如何快乐。我换了支蓝黑墨水的钢笔，希望那些稀有的蓝色能够调和我那些有些隐隐作痛的文字。</P>
<P>&nbsp;&nbsp; 我将就你给我寄来的信纸在背面写我给你的回信。我担心你会觉得我是用些陈词滥调敷衍你的情感，所以我坚持用笔亲自抒写那些点滴滴落却不曾泛滥的温情文字。我猜想着你的容貌，或许这不是那么重要，貌似就好像陌生人见面前的忐忑不安，我依然把光芒赋予在你的身上，那个说挚爱朗朗的漂亮女生。 <BR>　　黑色的夜晚总是与白昼貌似均衡的平分着每天。我却有些刻意地把自己划分入黑色阴霾顾及到的阴郁里，我们不能托词于习惯来解释我的习惯。这或许是受某某的影响，习惯某某说话时候的语气，习惯某某写字时候勾勒出的忧伤，习惯某某说话时候总习惯加上的那个貌似。你却与我不那么相同，至少我们从性别上讲应该柔刚相合。你不应该看着我的忧伤而忧伤，应该快乐地想着还有个比你忧伤的孩子，这并不是我常常所说的幸灾乐祸，这是种快乐的暗示，告诉我们需要各自幸福，因为彼此的幸福终究是需要各自去完成的。所以你的明媚需要包裹偶尔的忧伤。 <BR>　　我不知道说话的语调是否有些让人生恶了，教条似的有些让人反感的讲述性文字。我们都习惯听着老师的教诲明白人生，我们又总是抱怨教条似的烦琐文字给了老师处罚我们的诸多理由，可是我们终究是孩子，就好像人们总把我们比喻成花朵，而老师就像是园丁，他们裁剪我们，浇育我们，我们也总习惯了由他们的悉心照料而慢慢地茁壮成长。 <BR>　　我们的人生就是习惯些不习惯的事情，然后不习惯些习惯的事情。偶尔犯错或许不能让我们洗心革面，却能让我们知道错误及正确的所受到的不同境遇。每个孩子都需要表扬，不管是阴霾包裹明媚或是明媚包裹阴霾。我们不是冷血的动物，适时的转替角色或者属于心灵上的调节，我们的情感丰富却不廉价，我们不能刻意地出卖自己的情感甚至去卖弄所谓的忧伤，或者仅仅那样写些文字给陌生人看也是莫大的罪过，人终于还是追求真实的多些而虚度的假劣少些，所以你要相信，阳光终究会在风雨过后安抚泪水磅礴的大地及生在这里的我们。 <BR>　　很久没有用信纸写过这样的文字，似乎所有的书信都习惯了末尾给予个祝福。我誊写了你给我的来信的信封上的地址，然后习惯前人们的习惯工整地给你简短的来自某个午后祝福，祝你幸福。</P>
<P>&nbsp;&nbsp; 这或许不是个明媚的午后，空气里面的雨水已经足够酝酿某场恢弘的瓢泼舞曲。我并没有因为雨水的滋扰而感觉乌云倾覆，或许正是因为你给我的文字让我觉得了温暖，觉得明媚还是包裹着阴霾好些。 <BR>　　你告诉我说，我们终究是不那么相似的。我不同意你说让我幸灾乐祸地看待你的忧伤，或许我们终究是注定成为那些以忧伤为火种取暖的孩子。尽管我们不曾饥寒，我们不曾有过真正的悲苦命运，可是我们却延续着文字里面与生活毫无瓜葛的悲伤，那些幸福的悲伤及我们描绘悲伤时候所用的阴郁句子，华丽辞藻及漂亮的让人们捉摸不透的漂亮的修辞。或许某些人是由表及里的阴郁，或许我们是忧伤参半着快乐。</P>
<P>&nbsp;&nbsp; 我迷途在了青春编织的十字路口。 没有人告诉我将何去何从，我是否亦会如他们那样奔走天涯或者我与他们是不同的，我应该安分的让青春安然的死去。 <BR>　　没有人告诉我将如何选择，喜欢或者不喜欢，前赴后继或者开天辟地。我仅仅是个娇小的女生，他们眼里的柔弱，我眼里的无法拯救，我无法拯救自己就像我无法安然的忘记忧伤，无法安然放下青春。 <BR>　　我哭着抱着文字的符号啃着苍黄的记忆。烙印了青春身后的忧伤，镌刻了青春梦想的繁华。我在这里纪念前世苍老，憧憬后世青春。 <BR>　　我仅仅是微微疼痛并且微微哭泣的女生，还是那个喜欢你的文字及你的女生。</P>
<P>&nbsp;</P>]]></description>
</item><item>
<title><![CDATA[100 Best Places to Work in IT 2006]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17133</link>
<author>莹莹</author>
<pubDate>2006/8/2 13:54:15</pubDate>
<description><![CDATA[<A><FONT size=4>　</FONT></A>
<P><B><FONT size=4>June 19, 2006 </FONT></B><A href="http://www.computerworld.com/" target=_blank><FONT size=4>(Computerworld)</FONT></A><FONT size=4> -- Willy Anderson remembers the day he realized the human impact of the work he does at Allstate Insurance Co. When he started as an intern at the insurance giant at the age of 19, Anderson was responsible for maintaining the company's claims loss reporting system. As part of that job, he listened in on a call that the claim center received from a woman who had just been in a car accident. </FONT>
<P><FONT size=4>"She was crying because her husband was trapped in the car, and she wasn't sure if he was alive," says Anderson, now infrastructure services senior manager at the $33.9 billion insurer, which ranks No. 62 on <I><A href="http://www.computerworld.com/html/research/bestplaces/2006/bpchart_01_main.html">Computerworld's 2006 Best Places to Work in IT list</A></I>. "My work took on a whole new meaning after that. When you see how the claims reps can and can't touch the client when the system goes down, you realize you're in IT because of the promise Allstate sells its customers, not just because of your skill level with a given technology."</FONT></P>
<P><FONT size=4>Just as important, Anderson later shared his eye-opening experience with all of his direct reports, who thereafter also got a chance to listen in on claims calls. Their ability to appreciate the way Allstate touches its customers' lives -- along with Anderson's own freedom to institute that kind of change -- are both key ways in which the company makes individuals in IT know that their work matters, he says.</FONT></P>
<P><FONT size=4>It may seem difficult to believe that in this age where "employer" and "loyalty" don't often appear in the same sentence, employees of companies on this year's Best Places list agree that a big reason their firms deserve that ranking is because they foster a culture that nourishes not just their careers, but the human beings pursuing those careers as well. In fact, in our survey of more than 27,000 IT workers at this year's Best Places, 80% said their jobs are both interesting and challenging.</FONT></P>
<P><FONT size=4>"Salaries are a good thing, but it's all about the feeling on the part of the employee that they're part of the whole experience," says Dennis Foster, vice president of enterprise technology planning and engineering and architecture at Washington-based Marriott International Inc., No. 19 on the list. </FONT></P>
<P><FONT size=4></FONT></P>
<P><FONT size=4>Or as Cathy Brune, chief technology officer at Allstate, puts it, it's about encouraging employees to bring "the whole person" to work. "We try to create an environment where you can be not just a great technologist -- which is the left-brain, logical side -- but you can also use your right-brain, empathetic, creative side." That means recognizing that IT people need to feel valued, stretch their capabilities, be part of a community and lead a life outside of work.</FONT></P>
<P><FONT size=4>Best Places do this in myriad ways, such as making technology a vital part of the business strategy, fostering strong intracompany relationships, seeking and responding to feedback for improved work/life balance, enabling the flow of ideas and helping employees keep up with fast-changing technology.</FONT></P>
<P><FONT size=4>And there are other reasons why employees of these companies showed high satisfaction levels this year. Just 37% of the companies experienced IT layoffs, versus 43% the year before. Hiring is up, salaries are expected to climb, and the majority of companies will issue bonuses. And although employee satisfaction with morale and salaries stayed virtually the same, the percentage of respondents who agreed or strongly agreed that their jobs are secure rose from 68% to 71% this year.</FONT></P>]]></description>
</item><item>
<title><![CDATA[ini file class]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17127</link>
<author>莹莹</author>
<pubDate>2006/8/2 11:32:54</pubDate>
<description><![CDATA[
<P>// IniFile.cpp:&nbsp; Implementation of the CIniFile class.<BR>// Written by:&nbsp;&nbsp; Adam Clauss<BR>// Email: <A href="mailto:cabadam@tamu.edu">cabadam@tamu.edu</A><BR>// You may use this class/code as you wish in your programs.&nbsp; Feel free to distribute it, and<BR>// email suggested changes to me.<BR>//<BR>// Rewritten by: Shane Hill<BR>// Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 21/08/2001<BR>// Email:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="mailto:Shane.Hill@dsto.defence.gov.au">Shane.Hill@dsto.defence.gov.au</A><BR>// Reason:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Remove dependancy on MFC. Code should compile on any<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; platform. Tested on Windows/Linux/Irix<BR>//////////////////////////////////////////////////////////////////////</P>
<P>#ifndef CIniFile_H<BR>#define CIniFile_H</P>
<P>// C++ Includes<BR>#include &lt;string&gt;<BR>#include &lt;vector&gt;</P>
<P>// C Includes<BR>#include &lt;stdlib.h&gt;</P>
<P>#define MAX_KEYNAME&nbsp;&nbsp;&nbsp; 128<BR>#define MAX_VALUENAME&nbsp; 128<BR>#define MAX_VALUEDATA 2048</P>
<P>class CIniFile&nbsp; <BR>{<BR>private:<BR>&nbsp; bool&nbsp;&nbsp; caseInsensitive;<BR>&nbsp; string path;<BR>&nbsp; struct key {<BR>&nbsp;&nbsp;&nbsp; vector&lt;string&gt; names;<BR>&nbsp;&nbsp;&nbsp; vector&lt;string&gt; values; <BR>&nbsp;&nbsp;&nbsp; vector&lt;string&gt; comments;<BR>&nbsp; };<BR>&nbsp; vector&lt;key&gt;&nbsp;&nbsp;&nbsp; keys; <BR>&nbsp; vector&lt;string&gt; names; <BR>&nbsp; vector&lt;string&gt; comments;<BR>&nbsp; string CheckCase( string s) const;</P>
<P>public:<BR>&nbsp; enum errors{ noID = -1};<BR>&nbsp; CIniFile( string const iniPath = "");<BR>&nbsp; virtual ~CIniFile()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {}</P>
<P>&nbsp; // Sets whether or not keynames and valuenames should be case sensitive.<BR>&nbsp; // The default is case insensitive.vfg<BR>&nbsp; void CaseSensitive()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {caseInsensitive = false;}<BR>&nbsp; void CaseInsensitive()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {caseInsensitive = true;}</P>
<P>&nbsp; // Sets path of ini file to read and write from.<BR>&nbsp; void Path(string const newPath)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {path = newPath;}<BR>&nbsp; string Path() const&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {return path;}<BR>&nbsp; void SetPath(string const newPath)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {Path( newPath);}</P>
<P>&nbsp; // Reads ini file specified using path.<BR>&nbsp; // Returns true if successful, false otherwise.<BR>&nbsp; bool ReadFile();<BR>&nbsp; <BR>&nbsp; // Writes data stored in class to ini file.<BR>&nbsp; bool WriteFile(); <BR>&nbsp; <BR>&nbsp; // Deletes all stored ini data.<BR>&nbsp; void Erase();<BR>&nbsp; void Clear()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {Erase();}<BR>&nbsp; void Reset()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {Erase();}</P>
<P>&nbsp; // Returns index of specified key, or noID if not found.<BR>&nbsp; long FindKey( string const keyname) const;</P>
<P>&nbsp; // Returns index of specified value, in the specified key, or noID if not found.<BR>&nbsp; long FindValue( unsigned const keyID, string const valuename) const;</P>
<P>&nbsp; // Returns number of keys currently in the ini.<BR>&nbsp; unsigned NumKeys() const&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {return names.size();}<BR>&nbsp; unsigned GetNumKeys() const&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {return NumKeys();}</P>
<P>&nbsp; // Add a key name.<BR>&nbsp; unsigned AddKeyName( string const keyname);</P>
<P>&nbsp; // Returns key names by index.<BR>&nbsp; string KeyName( unsigned const keyID) const;<BR>&nbsp; string GetKeyName( unsigned const keyID) const {return KeyName(keyID);}</P>
<P>&nbsp; // Returns number of values stored for specified key.<BR>&nbsp; unsigned NumValues( unsigned const keyID);<BR>&nbsp; unsigned GetNumValues( unsigned const keyID)&nbsp;&nbsp; {return NumValues( keyID);}<BR>&nbsp; unsigned NumValues( string const keyname);<BR>&nbsp; unsigned GetNumValues( string const keyname)&nbsp;&nbsp; {return NumValues( keyname);}</P>
<P>&nbsp; // Returns value name by index for a given keyname or keyID.<BR>&nbsp; string ValueName( unsigned const keyID, unsigned const valueID) const;<BR>&nbsp; string GetValueName( unsigned const keyID, unsigned const valueID) const {<BR>&nbsp;&nbsp;&nbsp; return ValueName( keyID, valueID);<BR>&nbsp; }<BR>&nbsp; string ValueName( string const keyname, unsigned const valueID) const;<BR>&nbsp; string GetValueName( string const keyname, unsigned const valueID) const {<BR>&nbsp;&nbsp;&nbsp; return ValueName( keyname, valueID);<BR>&nbsp; }</P>
<P>&nbsp; // Gets value of [keyname] valuename =.<BR>&nbsp; // Overloaded to return string, int, and double.<BR>&nbsp; // Returns defValue if key/value not found.<BR>&nbsp; string GetValue( unsigned const keyID, unsigned const valueID, string const defValue = "") const;<BR>&nbsp; string GetValue(string const keyname, string const valuename, string const defValue = "") const; <BR>&nbsp; int&nbsp;&nbsp;&nbsp; GetValueI(string const keyname, string const valuename, int const defValue = 0) const;<BR>&nbsp; bool&nbsp;&nbsp; GetValueB(string const keyname, string const valuename, bool const defValue = false) const {<BR>&nbsp;&nbsp;&nbsp; return bool( GetValueI( keyname, valuename, int( defValue)));<BR>&nbsp; }<BR>&nbsp; double&nbsp;&nbsp; GetValueF(string const keyname, string const valuename, double const defValue = 0.0) const;<BR>&nbsp; // This is a variable length formatted GetValue routine. All these voids<BR>&nbsp; // are required because there is no vsscanf() like there is a vsprintf().<BR>&nbsp; // Only a maximum of 8 variable can be read.<BR>&nbsp; unsigned GetValueV( string const keyname, string const valuename, char *format,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void *v1 = 0, void *v2 = 0, void *v3 = 0, void *v4 = 0,<BR>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void *v5 = 0, void *v6 = 0, void *v7 = 0, void *v8 = 0,<BR>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void *v9 = 0, void *v10 = 0, void *v11 = 0, void *v12 = 0,<BR>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void *v13 = 0, void *v14 = 0, void *v15 = 0, void *v16 = 0);</P>
<P>&nbsp; // Sets value of [keyname] valuename =.<BR>&nbsp; // Specify the optional paramter as false (0) if you do not want it to create<BR>&nbsp; // the key if it doesn't exist. Returns true if data entered, false otherwise.<BR>&nbsp; // Overloaded to accept string, int, and double.<BR>&nbsp; bool SetValue( unsigned const keyID, unsigned const valueID, string const value);<BR>&nbsp; bool SetValue( string const keyname, string const valuename, string const value, bool const create = true);<BR>&nbsp; bool SetValueI( string const keyname, string const valuename, int const value, bool const create = true);<BR>&nbsp; bool SetValueB( string const keyname, string const valuename, bool const value, bool const create = true) {<BR>&nbsp;&nbsp;&nbsp; return SetValueI( keyname, valuename, int(value), create);<BR>&nbsp; }<BR>&nbsp; bool SetValueF( string const keyname, string const valuename, double const value, bool const create = true);<BR>&nbsp; bool SetValueV( string const keyname, string const valuename, char *format, ...);</P>
<P>&nbsp; // Deletes specified value.<BR>&nbsp; // Returns true if value existed and deleted, false otherwise.<BR>&nbsp; bool DeleteValue( string const keyname, string const valuename);<BR>&nbsp; <BR>&nbsp; // Deletes specified key and all values contained within.<BR>&nbsp; // Returns true if key existed and deleted, false otherwise.<BR>&nbsp; bool DeleteKey(string keyname);</P>
<P>&nbsp; // Header comment functions.<BR>&nbsp; // Header comments are those comments before the first key.<BR>&nbsp; //<BR>&nbsp; // Number of header comments.<BR>&nbsp; unsigned NumHeaderComments()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {return comments.size();}<BR>&nbsp; // Add a header comment.<BR>&nbsp; void&nbsp;&nbsp;&nbsp;&nbsp; HeaderComment( string const comment);<BR>&nbsp; // Return a header comment.<BR>&nbsp; string&nbsp;&nbsp; HeaderComment( unsigned const commentID) const;<BR>&nbsp; // Delete a header comment.<BR>&nbsp; bool&nbsp;&nbsp;&nbsp;&nbsp; DeleteHeaderComment( unsigned commentID);<BR>&nbsp; // Delete all header comments.<BR>&nbsp; void&nbsp;&nbsp;&nbsp;&nbsp; DeleteHeaderComments()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {comments.clear();}</P>
<P>&nbsp; // Key comment functions.<BR>&nbsp; // Key comments are those comments within a key. Any comments<BR>&nbsp; // defined within value names will be added to this list. Therefore,<BR>&nbsp; // these comments will be moved to the top of the key definition when<BR>&nbsp; // the CIniFile::WriteFile() is called.<BR>&nbsp; //<BR>&nbsp; // Number of key comments.<BR>&nbsp; unsigned NumKeyComments( unsigned const keyID) const;<BR>&nbsp; unsigned NumKeyComments( string const keyname) const;<BR>&nbsp; // Add a key comment.<BR>&nbsp; bool&nbsp;&nbsp;&nbsp;&nbsp; KeyComment( unsigned const keyID, string const comment);<BR>&nbsp; bool&nbsp;&nbsp;&nbsp;&nbsp; KeyComment( string const keyname, string const comment);<BR>&nbsp; // Return a key comment.<BR>&nbsp; string&nbsp;&nbsp; KeyComment( unsigned const keyID, unsigned const commentID) const;<BR>&nbsp; string&nbsp;&nbsp; KeyComment( string const keyname, unsigned const commentID) const;<BR>&nbsp; // Delete a key comment.<BR>&nbsp; bool&nbsp;&nbsp;&nbsp;&nbsp; DeleteKeyComment( unsigned const keyID, unsigned const commentID);<BR>&nbsp; bool&nbsp;&nbsp;&nbsp;&nbsp; DeleteKeyComment( string const keyname, unsigned const commentID);<BR>&nbsp; // Delete all comments for a key.<BR>&nbsp; bool&nbsp;&nbsp;&nbsp;&nbsp; DeleteKeyComments( unsigned const keyID);<BR>&nbsp; bool&nbsp;&nbsp;&nbsp;&nbsp; DeleteKeyComments( string const keyname);<BR>};</P>
<P>#endif</P>
<P>// IniFile.cpp:&nbsp; Implementation of the CIniFile class.<BR>// Written by:&nbsp;&nbsp; Adam Clauss<BR>// Email: <A href="mailto:cabadam@houston.rr.com">cabadam@houston.rr.com</A><BR>// You may use this class/code as you wish in your programs.&nbsp; Feel free to distribute it, and<BR>// email suggested changes to me.<BR>//<BR>// Rewritten by: Shane Hill<BR>// Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 21/08/2001<BR>// Email:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="mailto:Shane.Hill@dsto.defence.gov.au">Shane.Hill@dsto.defence.gov.au</A><BR>// Reason:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Remove dependancy on MFC. Code should compile on any<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; platform.<BR>//////////////////////////////////////////////////////////////////////</P>
<P>// C++ Includes<BR>#include &lt;iostream&gt;<BR>#include &lt;fstream&gt;<BR>#include &lt;strstream&gt;</P>
<P>using namespace std;</P>
<P>// C Includes<BR>#include &lt;stdio.h&gt;<BR>#include &lt;stdarg.h&gt;<BR>#include &lt;ctype.h&gt;</P>
<P>// Local Includes<BR>#include "iniFile.h"</P>
<P>#if defined(WIN32)<BR>#define iniEOL endl<BR>#else<BR>#define iniEOL '\r' &lt;&lt; endl<BR>#endif</P>
<P>CIniFile::CIniFile( string const iniPath)<BR>{<BR>&nbsp; Path( iniPath);<BR>&nbsp; caseInsensitive = true;<BR>}</P>
<P>bool CIniFile::ReadFile()<BR>{<BR>&nbsp; // Normally you would use ifstream, but the SGI CC compiler has<BR>&nbsp; // a few bugs with ifstream. So ... fstream used.<BR>&nbsp; fstream f;<BR>&nbsp; string&nbsp;&nbsp; line;<BR>&nbsp; string&nbsp;&nbsp; keyname, valuename, value;<BR>&nbsp; string::size_type pLeft, pRight;</P>
<P>&nbsp; f.open( path.c_str(), ios::in);<BR>&nbsp; if ( f.fail())<BR>&nbsp;&nbsp;&nbsp; return false;<BR>&nbsp; <BR>&nbsp; while( getline( f, line)) {<BR>&nbsp;&nbsp;&nbsp; // To be compatible with Win32, check for existence of '\r'.<BR>&nbsp;&nbsp;&nbsp; // Win32 files have the '\r' and Unix files don't at the end of a line.<BR>&nbsp;&nbsp;&nbsp; // Note that the '\r' will be written to INI files from<BR>&nbsp;&nbsp;&nbsp; // Unix so that the created INI file can be read under Win32<BR>&nbsp;&nbsp;&nbsp; // without change.<BR>&nbsp;&nbsp;&nbsp; if ( line[line.length() - 1] == '\r')<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line = line.substr( 0, line.length() - 1);<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; if ( line.length()) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Check that the user hasn't openned a binary file by checking the first<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // character of each line!<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( !isprint( line[0])) {<BR>&nbsp;printf( "Failing on char %d\n", line[0]);<BR>&nbsp;f.close();<BR>&nbsp;return false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (( pLeft = line.find_first_of(";#[=")) != string::npos) {<BR>&nbsp;switch ( line[pLeft]) {<BR>&nbsp;case '[':<BR>&nbsp;&nbsp; if ((pRight = line.find_last_of("]")) != string::npos &amp;&amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pRight &gt; pLeft) {<BR>&nbsp;&nbsp;&nbsp;&nbsp; keyname = line.substr( pLeft + 1, pRight - pLeft - 1);<BR>&nbsp;&nbsp;&nbsp;&nbsp; AddKeyName( keyname);<BR>&nbsp;&nbsp; }<BR>&nbsp;&nbsp; break;<BR>&nbsp;&nbsp; <BR>&nbsp;case '=':<BR>&nbsp;&nbsp; valuename = line.substr( 0, pLeft);<BR>&nbsp;&nbsp; value = line.substr( pLeft + 1);<BR>&nbsp;&nbsp; SetValue( keyname, valuename, value);<BR>&nbsp;&nbsp; break;<BR>&nbsp;&nbsp; <BR>&nbsp;case ';':<BR>&nbsp;case '#':<BR>&nbsp;&nbsp; if ( !names.size())<BR>&nbsp;&nbsp;&nbsp;&nbsp; HeaderComment( line.substr( pLeft + 1));<BR>&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp; KeyComment( keyname, line.substr( pLeft + 1));<BR>&nbsp;&nbsp; break;<BR>&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; }</P>
<P>&nbsp; f.close();<BR>&nbsp; if ( names.size())<BR>&nbsp;&nbsp;&nbsp; return true;<BR>&nbsp; return false;<BR>}</P>
<P>bool CIniFile::WriteFile()<BR>{<BR>&nbsp; unsigned commentID, keyID, valueID;<BR>&nbsp; // Normally you would use ofstream, but the SGI CC compiler has<BR>&nbsp; // a few bugs with ofstream. So ... fstream used.<BR>&nbsp; fstream f;</P>
<P>&nbsp; f.open( path.c_str(), ios::out);<BR>&nbsp; if ( f.fail())<BR>&nbsp;&nbsp;&nbsp; return false;</P>
<P>&nbsp; // Write header comments.<BR>&nbsp; for ( commentID = 0; commentID &lt; comments.size(); ++commentID)<BR>&nbsp;&nbsp;&nbsp; f &lt;&lt; ';' &lt;&lt; comments[commentID] &lt;&lt; iniEOL;<BR>&nbsp; if ( comments.size())<BR>&nbsp;&nbsp;&nbsp; f &lt;&lt; iniEOL;</P>
<P>&nbsp; // Write keys and values.<BR>&nbsp; for ( keyID = 0; keyID &lt; keys.size(); ++keyID) {<BR>&nbsp;&nbsp;&nbsp; f &lt;&lt; '[' &lt;&lt; names[keyID] &lt;&lt; ']' &lt;&lt; iniEOL;<BR>&nbsp;&nbsp;&nbsp; // Comments.<BR>&nbsp;&nbsp;&nbsp; for ( commentID = 0; commentID &lt; keys[keyID].comments.size(); ++commentID)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f &lt;&lt; ';' &lt;&lt; keys[keyID].comments[commentID] &lt;&lt; iniEOL;<BR>&nbsp;&nbsp;&nbsp; // Values.<BR>&nbsp;&nbsp;&nbsp; for ( valueID = 0; valueID &lt; keys[keyID].names.size(); ++valueID)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f &lt;&lt; keys[keyID].names[valueID] &lt;&lt; '=' &lt;&lt; keys[keyID].values[valueID] &lt;&lt; iniEOL;<BR>&nbsp;&nbsp;&nbsp; f &lt;&lt; iniEOL;<BR>&nbsp; }<BR>&nbsp; f.close();<BR>&nbsp; <BR>&nbsp; return true;<BR>}</P>
<P>long CIniFile::FindKey( string const keyname) const<BR>{<BR>&nbsp; for ( unsigned keyID = 0; keyID &lt; names.size(); ++keyID)<BR>&nbsp;&nbsp;&nbsp; if ( CheckCase( names[keyID]) == CheckCase( keyname))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return long(keyID);<BR>&nbsp; return noID;<BR>}</P>
<P>long CIniFile::FindValue( unsigned const keyID, string const valuename) const<BR>{<BR>&nbsp; if ( !keys.size() || keyID &gt;= keys.size())<BR>&nbsp;&nbsp;&nbsp; return noID;</P>
<P>&nbsp; for ( unsigned valueID = 0; valueID &lt; keys[keyID].names.size(); ++valueID)<BR>&nbsp;&nbsp;&nbsp; if ( CheckCase( keys[keyID].names[valueID]) == CheckCase( valuename))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return long(valueID);<BR>&nbsp; return noID;<BR>}</P>
<P>unsigned CIniFile::AddKeyName( string const keyname)<BR>{<BR>&nbsp; names.resize( names.size() + 1, keyname);<BR>&nbsp; keys.resize( keys.size() + 1);<BR>&nbsp; return names.size() - 1;<BR>}</P>
<P>string CIniFile::KeyName( unsigned const keyID) const<BR>{<BR>&nbsp; if ( keyID &lt; names.size())<BR>&nbsp;&nbsp;&nbsp; return names[keyID];<BR>&nbsp; else<BR>&nbsp;&nbsp;&nbsp; return "";<BR>}</P>
<P>unsigned CIniFile::NumValues( unsigned const keyID)<BR>{<BR>&nbsp; if ( keyID &lt; keys.size())<BR>&nbsp;&nbsp;&nbsp; return keys[keyID].names.size();<BR>&nbsp; return 0;<BR>}</P>
<P>unsigned CIniFile::NumValues( string const keyname)<BR>{<BR>&nbsp; long keyID = FindKey( keyname);<BR>&nbsp; if ( keyID == noID)<BR>&nbsp;&nbsp;&nbsp; return 0;<BR>&nbsp; return keys[keyID].names.size();<BR>}</P>
<P>string CIniFile::ValueName( unsigned const keyID, unsigned const valueID) const<BR>{<BR>&nbsp; if ( keyID &lt; keys.size() &amp;&amp; valueID &lt; keys[keyID].names.size())<BR>&nbsp;&nbsp;&nbsp; return keys[keyID].names[valueID];<BR>&nbsp; return "";<BR>}</P>
<P>string CIniFile::ValueName( string const keyname, unsigned const valueID) const<BR>{<BR>&nbsp; long keyID = FindKey( keyname);<BR>&nbsp; if ( keyID == noID)<BR>&nbsp;&nbsp;&nbsp; return "";<BR>&nbsp; return ValueName( keyID, valueID);<BR>}</P>
<P>bool CIniFile::SetValue( unsigned const keyID, unsigned const valueID, string const value)<BR>{<BR>&nbsp; if ( keyID &lt; keys.size() &amp;&amp; valueID &lt; keys[keyID].names.size())<BR>&nbsp;&nbsp;&nbsp; keys[keyID].values[valueID] = value;</P>
<P>&nbsp; return false;<BR>}</P>
<P>bool CIniFile::SetValue( string const keyname, string const valuename, string const value, bool const create)<BR>{<BR>&nbsp; long keyID = FindKey( keyname);<BR>&nbsp; if ( keyID == noID) {<BR>&nbsp;&nbsp;&nbsp; if ( create)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; keyID = long( AddKeyName( keyname));<BR>&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;<BR>&nbsp; }</P>
<P>&nbsp; long valueID = FindValue( unsigned(keyID), valuename);<BR>&nbsp; if ( valueID == noID) {<BR>&nbsp;&nbsp;&nbsp; if ( !create)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;<BR>&nbsp;&nbsp;&nbsp; keys[keyID].names.resize( keys[keyID].names.size() + 1, valuename);<BR>&nbsp;&nbsp;&nbsp; keys[keyID].values.resize( keys[keyID].values.size() + 1, value);<BR>&nbsp; } else<BR>&nbsp;&nbsp;&nbsp; keys[keyID].values[valueID] = value;</P>
<P>&nbsp; return true;<BR>}</P>
<P>bool CIniFile::SetValueI( string const keyname, string const valuename, int const value, bool const create)<BR>{<BR>&nbsp; char svalue[MAX_VALUEDATA];</P>
<P>&nbsp; sprintf( svalue, "%d", value);<BR>&nbsp; return SetValue( keyname, valuename, svalue);<BR>}</P>
<P>bool CIniFile::SetValueF( string const keyname, string const valuename, double const value, bool const create)<BR>{<BR>&nbsp; char svalue[MAX_VALUEDATA];</P>
<P>&nbsp; sprintf( svalue, "%f", value);<BR>&nbsp; return SetValue( keyname, valuename, svalue);<BR>}</P>
<P>bool CIniFile::SetValueV( string const keyname, string const valuename, char *format, ...)<BR>{<BR>&nbsp; va_list args;<BR>&nbsp; char value[MAX_VALUEDATA];</P>
<P>&nbsp; va_start( args, format);<BR>&nbsp; vsprintf( value, format, args);<BR>&nbsp; va_end( args);<BR>&nbsp; return SetValue( keyname, valuename, value);<BR>}</P>
<P>string CIniFile::GetValue( unsigned const keyID, unsigned const valueID, string const defValue) const<BR>{<BR>&nbsp; if ( keyID &lt; keys.size() &amp;&amp; valueID &lt; keys[keyID].names.size())<BR>&nbsp;&nbsp;&nbsp; return keys[keyID].values[valueID];<BR>&nbsp; return defValue;<BR>}</P>
<P>string CIniFile::GetValue( string const keyname, string const valuename, string const defValue) const<BR>{<BR>&nbsp; long keyID = FindKey( keyname);<BR>&nbsp; if ( keyID == noID)<BR>&nbsp;&nbsp;&nbsp; return defValue;</P>
<P>&nbsp; long valueID = FindValue( unsigned(keyID), valuename);<BR>&nbsp; if ( valueID == noID)<BR>&nbsp;&nbsp;&nbsp; return defValue;</P>
<P>&nbsp; return keys[keyID].values[valueID];<BR>}</P>
<P>int CIniFile::GetValueI(string const keyname, string const valuename, int const defValue) const<BR>{<BR>&nbsp; char svalue[MAX_VALUEDATA];</P>
<P>&nbsp; sprintf( svalue, "%d", defValue);<BR>&nbsp; return atoi( GetValue( keyname, valuename, svalue).c_str()); <BR>}</P>
<P>double CIniFile::GetValueF(string const keyname, string const valuename, double const defValue) const<BR>{<BR>&nbsp; char svalue[MAX_VALUEDATA];</P>
<P>&nbsp; sprintf( svalue, "%f", defValue);<BR>&nbsp; return atof( GetValue( keyname, valuename, svalue).c_str()); <BR>}</P>
<P>// 16 variables may be a bit of over kill, but hey, it's only code.<BR>unsigned CIniFile::GetValueV( string const keyname, string const valuename, char *format,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void *v1, void *v2, void *v3, void *v4,<BR>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void *v5, void *v6, void *v7, void *v8,<BR>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void *v9, void *v10, void *v11, void *v12,<BR>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void *v13, void *v14, void *v15, void *v16)<BR>{<BR>&nbsp; string&nbsp;&nbsp; value;<BR>&nbsp; // va_list&nbsp; args;<BR>&nbsp; unsigned nVals;</P>
<P><BR>&nbsp; value = GetValue( keyname, valuename);<BR>&nbsp; if ( !value.length())<BR>&nbsp;&nbsp;&nbsp; return false;<BR>&nbsp; // Why is there not vsscanf() function. Linux man pages say that there is<BR>&nbsp; // but no compiler I've seen has it defined. Bummer!<BR>&nbsp; //<BR>&nbsp; // va_start( args, format);<BR>&nbsp; // nVals = vsscanf( value.c_str(), format, args);<BR>&nbsp; // va_end( args);</P>
<P>&nbsp; nVals = sscanf( value.c_str(), format,<BR>&nbsp;&nbsp;&nbsp; v1, v2, v3, v4, v5, v6, v7, v8,<BR>&nbsp;&nbsp;&nbsp; v9, v10, v11, v12, v13, v14, v15, v16);</P>
<P>&nbsp; return nVals;<BR>}</P>
<P>bool CIniFile::DeleteValue( string const keyname, string const valuename)<BR>{<BR>&nbsp; long keyID = FindKey( keyname);<BR>&nbsp; if ( keyID == noID)<BR>&nbsp;&nbsp;&nbsp; return false;</P>
<P>&nbsp; long valueID = FindValue( unsigned(keyID), valuename);<BR>&nbsp; if ( valueID == noID)<BR>&nbsp;&nbsp;&nbsp; return false;</P>
<P>&nbsp; // This looks strange, but is neccessary.<BR>&nbsp; vector&lt;string&gt;::iterator npos = keys[keyID].names.begin() + valueID;<BR>&nbsp; vector&lt;string&gt;::iterator vpos = keys[keyID].values.begin() + valueID;<BR>&nbsp; keys[keyID].names.erase( npos, npos + 1);<BR>&nbsp; keys[keyID].values.erase( vpos, vpos + 1);</P>
<P>&nbsp; return true;<BR>}</P>
<P>bool CIniFile::DeleteKey( string const keyname)<BR>{<BR>&nbsp; long keyID = FindKey( keyname);<BR>&nbsp; if ( keyID == noID)<BR>&nbsp;&nbsp;&nbsp; return false;</P>
<P>&nbsp; // Now hopefully this destroys the vector lists within keys.<BR>&nbsp; // Looking at &lt;vector&gt; source, this should be the case using the destructor.<BR>&nbsp; // If not, I may have to do it explicitly. Memory leak check should tell.<BR>&nbsp; // memleak_test.cpp shows that the following not required.<BR>&nbsp; //keys[keyID].names.clear();<BR>&nbsp; //keys[keyID].values.clear();</P>
<P>&nbsp; vector&lt;string&gt;::iterator npos = names.begin() + keyID;<BR>&nbsp; vector&lt;key&gt;::iterator&nbsp;&nbsp;&nbsp; kpos = keys.begin() + keyID;<BR>&nbsp; names.erase( npos, npos + 1);<BR>&nbsp; keys.erase( kpos, kpos + 1);</P>
<P>&nbsp; return true;<BR>}</P>
<P>void CIniFile::Erase()<BR>{<BR>&nbsp; // This loop not needed. The vector&lt;&gt; destructor seems to do<BR>&nbsp; // all the work itself. memleak_test.cpp shows this.<BR>&nbsp; //for ( unsigned i = 0; i &lt; keys.size(); ++i) {<BR>&nbsp; //&nbsp; keys[i].names.clear();<BR>&nbsp; //&nbsp; keys[i].values.clear();<BR>&nbsp; //}<BR>&nbsp; names.clear();<BR>&nbsp; keys.clear();<BR>&nbsp; comments.clear();<BR>}</P>
<P>void CIniFile::HeaderComment( string const comment)<BR>{<BR>&nbsp; comments.resize( comments.size() + 1, comment);<BR>}</P>
<P>string CIniFile::HeaderComment( unsigned const commentID) const<BR>{<BR>&nbsp; if ( commentID &lt; comments.size())<BR>&nbsp;&nbsp;&nbsp; return comments[commentID];<BR>&nbsp; return "";<BR>}</P>
<P>bool CIniFile::DeleteHeaderComment( unsigned commentID)<BR>{<BR>&nbsp; if ( commentID &lt; comments.size()) {<BR>&nbsp;&nbsp;&nbsp; vector&lt;string&gt;::iterator cpos = comments.begin() + commentID;<BR>&nbsp;&nbsp;&nbsp; comments.erase( cpos, cpos + 1);<BR>&nbsp;&nbsp;&nbsp; return true;<BR>&nbsp; }<BR>&nbsp; return false;<BR>}</P>
<P>unsigned CIniFile::NumKeyComments( unsigned const keyID) const<BR>{<BR>&nbsp; if ( keyID &lt; keys.size())<BR>&nbsp;&nbsp;&nbsp; return keys[keyID].comments.size();<BR>&nbsp; return 0;<BR>}</P>
<P>unsigned CIniFile::NumKeyComments( string const keyname) const<BR>{<BR>&nbsp; long keyID = FindKey( keyname);<BR>&nbsp; if ( keyID == noID)<BR>&nbsp;&nbsp;&nbsp; return 0;<BR>&nbsp; return keys[keyID].comments.size();<BR>}</P>
<P>bool CIniFile::KeyComment( unsigned const keyID, string const comment)<BR>{<BR>&nbsp; if ( keyID &lt; keys.size()) {<BR>&nbsp;&nbsp;&nbsp; keys[keyID].comments.resize( keys[keyID].comments.size() + 1, comment);<BR>&nbsp;&nbsp;&nbsp; return true;<BR>&nbsp; }<BR>&nbsp; return false;<BR>}</P>
<P>bool CIniFile::KeyComment( string const keyname, string const comment)<BR>{<BR>&nbsp; long keyID = FindKey( keyname);<BR>&nbsp; if ( keyID == noID)<BR>&nbsp;&nbsp;&nbsp; return false;<BR>&nbsp; return KeyComment( unsigned(keyID), comment);<BR>}</P>
<P>string CIniFile::KeyComment( unsigned const keyID, unsigned const commentID) const<BR>{<BR>&nbsp; if ( keyID &lt; keys.size() &amp;&amp; commentID &lt; keys[keyID].comments.size())<BR>&nbsp;&nbsp;&nbsp; return keys[keyID].comments[commentID];<BR>&nbsp; return "";<BR>}</P>
<P>string CIniFile::KeyComment( string const keyname, unsigned const commentID) const<BR>{<BR>&nbsp; long keyID = FindKey( keyname);<BR>&nbsp; if ( keyID == noID)<BR>&nbsp;&nbsp;&nbsp; return "";<BR>&nbsp; return KeyComment( unsigned(keyID), commentID);<BR>}</P>
<P>bool CIniFile::DeleteKeyComment( unsigned const keyID, unsigned const commentID)<BR>{<BR>&nbsp; if ( keyID &lt; keys.size() &amp;&amp; commentID &lt; keys[keyID].comments.size()) {<BR>&nbsp;&nbsp;&nbsp; vector&lt;string&gt;::iterator cpos = keys[keyID].comments.begin() + commentID;<BR>&nbsp;&nbsp;&nbsp; keys[keyID].comments.erase( cpos, cpos + 1);<BR>&nbsp;&nbsp;&nbsp; return true;<BR>&nbsp; }<BR>&nbsp; return false;<BR>}</P>
<P>bool CIniFile::DeleteKeyComment( string const keyname, unsigned const commentID)<BR>{<BR>&nbsp; long keyID = FindKey( keyname);<BR>&nbsp; if ( keyID == noID)<BR>&nbsp;&nbsp;&nbsp; return false;<BR>&nbsp; return DeleteKeyComment( unsigned(keyID), commentID);<BR>}</P>
<P>bool CIniFile::DeleteKeyComments( unsigned const keyID)<BR>{<BR>&nbsp; if ( keyID &lt; keys.size()) {<BR>&nbsp;&nbsp;&nbsp; keys[keyID].comments.clear();<BR>&nbsp;&nbsp;&nbsp; return true;<BR>&nbsp; }<BR>&nbsp; return false;<BR>}</P>
<P>bool CIniFile::DeleteKeyComments( string const keyname)<BR>{<BR>&nbsp; long keyID = FindKey( keyname);<BR>&nbsp; if ( keyID == noID)<BR>&nbsp;&nbsp;&nbsp; return false;<BR>&nbsp; return DeleteKeyComments( unsigned(keyID));<BR>}</P>
<P>string CIniFile::CheckCase( string s) const<BR>{<BR>&nbsp; if ( caseInsensitive)<BR>&nbsp;&nbsp;&nbsp; for ( string::size_type i = 0; i &lt; s.length(); ++i)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s[i] = tolower(s[i]);<BR>&nbsp; return s;<BR>}<BR></P>
<P>//info.h 为自己的应用提供接口<BR>#include &lt;string&gt;</P>
<P>using namespace std;<BR>class CGetInfo<BR>{<BR>public:<BR>&nbsp;CGetInfo();<BR>&nbsp;CGetInfo(string iniFileAddress);<BR>&nbsp;~CGetInfo() {}<BR>&nbsp;string GetEmail();<BR>&nbsp;int GetRtime();<BR>&nbsp;&nbsp;&nbsp; int GetRnumber();<BR>&nbsp;&nbsp;&nbsp; string GetLlist();<BR>&nbsp;&nbsp;&nbsp; string GetRlist();<BR>&nbsp;&nbsp;&nbsp; string GetIp();<BR>&nbsp;&nbsp;&nbsp; int GetPort();<BR>&nbsp;&nbsp;&nbsp; string GetFilename();<BR>&nbsp;&nbsp;&nbsp; string GetUsername();<BR>&nbsp;&nbsp;&nbsp; string GetPassword();<BR>private:<BR>&nbsp;&nbsp;&nbsp; string m_iniFileAddress;<BR>};</P>
<P>//info.cpp</P>
<P>#include &lt;stdio.h&gt;<BR>#include &lt;string.h&gt;<BR>#include "info.h"<BR>#include "iniFile.h" </P>
<P>CIniFile iniFile;</P>
<P>CGetInfo::CGetInfo()<BR>{<BR>&nbsp;iniFile.Path("./ini_test.ini");<BR>&nbsp;iniFile.ReadFile();<BR>}<BR>CGetInfo::CGetInfo(string iniFileAddress)<BR>{ <BR>&nbsp;m_iniFileAddress=iniFileAddress;<BR>&nbsp;iniFile.Path(m_iniFileAddress);<BR>&nbsp;iniFile.ReadFile();<BR>}<BR>&nbsp;string CGetInfo::GetEmail()<BR>{&nbsp; <BR>&nbsp;return iniFile.GetValue( "userinfo", "emailadd");<BR>}<BR>&nbsp;string CGetInfo::GetFilename()<BR>{<BR>&nbsp;return iniFile.GetValue( "fileinfo", "filename");<BR>}<BR>&nbsp;string CGetInfo::GetIp()<BR>{<BR>&nbsp;return iniFile.GetValue( "hostinfo", "ipaddress");<BR>}<BR>&nbsp;string CGetInfo::GetLlist()<BR>{<BR>&nbsp;return iniFile.GetValue( "fileinfo", "locallist");<BR>}<BR>&nbsp;string CGetInfo::GetPassword()<BR>{<BR>&nbsp;return iniFile.GetValue( "userinfo", "password");<BR>}<BR>int CGetInfo::GetPort()<BR>{<BR>&nbsp;return iniFile.GetValueI( "hostinfo", "port");<BR>}<BR>string CGetInfo::GetRlist()<BR>{<BR>&nbsp;return iniFile.GetValue( "fileinfo", "remotelist");<BR>}<BR>int CGetInfo::GetRnumber()<BR>{<BR>&nbsp;return iniFile.GetValueI( "timeinfo", "retrynumber");<BR>}<BR>int CGetInfo::GetRtime()<BR>{<BR>&nbsp;return iniFile.GetValueI( "timeinfo", "retrytime");<BR>}<BR>&nbsp;string CGetInfo::GetUsername()<BR>{<BR>&nbsp;return iniFile.GetValue( "userinfo", "username");<BR>}<BR></P>
<P>//test<BR>#include &lt;iostream&gt;</P>
<P>using namespace std;<BR>#include &lt;string&gt;<BR>#include "iniFile.h"<BR>#include "info.h"</P>
<P>int main()<BR>{<BR>&nbsp;//CGetInfo getInfo("c:\\ini_test.ini");<BR>&nbsp;CGetInfo getInfo；<BR>&nbsp;string sl;</P>
<P>&nbsp;sl=getInfo.GetEmail();<BR>&nbsp;cout&lt;&lt; sl&lt;&lt;endl;</P>
<P>&nbsp;&nbsp; int i;<BR>&nbsp;&nbsp; cin&gt;&gt;i;<BR>&nbsp;&nbsp; return 0;<BR>}</P>
<P>ini_test.ini 文件放在自己设定的路径下，或者放在默认路径当前路径下[hostinfo]<BR>ipaddress=127.0.0.1<BR>port=21<BR>; This is another test comment for 386enh<BR>; This is another test comment for 386enh</P>
<P><BR>[fileinfo]<BR>filename=mappoint.h<BR>locallist=f:\download\mappoint.h<BR>remotelist=c:\mappoint.h</P>
<P>[timeinfo]<BR>retrynumber=5<BR>retrytime=2</P>
<P>[userinfo]<BR>username=casper<BR>password=123456<BR><A href="mailto:emailadd=huimingsu@nettech-global.com">emailadd=huimingsu@nettech-global.com</A></P>
<P><IMG src="http://blogger.org.cn/blog/images/file/zip.gif" border=0><A href="http://blogger.org.cn/blog/uploadfile/200682115918880.RAR" target=_blank>ini.rar</A></P>
<P>&nbsp;</P>]]></description>
</item><item>
<title><![CDATA[log file class]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17121</link>
<author>莹莹</author>
<pubDate>2006/8/2 10:40:12</pubDate>
<description><![CDATA[
<P>//CLog.h</P>
<P>#include &lt;string&gt;</P>
<P>using namespace std;</P>
<P>//日志文件类<BR>//用来把系统运行过程中的状态信息保存在文件中以方便用户跟踪的类<BR>class CLog<BR>{<BR>public:<BR>&nbsp;CLog();//默认情况下日志的保存地点为当前目录，日志名称info.log</P>
<P>&nbsp;CLog(const string dir);//用户自定义日志文件的保存目录及文件名</P>
<P>&nbsp;void log(const string title, const string desc);//用来向日志文件输出信息的成员函数</P>
<P>&nbsp;&nbsp;&nbsp; void log(const string &amp;text);</P>
<P>&nbsp;CLog &amp;operator &lt;&lt; ( const char * text);</P>
<P>&nbsp;&nbsp;&nbsp; CLog &amp;operator &lt;&lt; ( const string &amp;text);<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp; CLog &amp;operator &lt;&lt; ( const int value); <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp; CLog &amp;operator &lt;&lt; ( const unsigned int value); <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp; CLog &amp;operator &lt;&lt; ( const float value);<BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp; CLog &amp;operator &lt;&lt; ( const double value);<BR>private:<BR>&nbsp;&nbsp;&nbsp; string m_LogDir;<BR>&nbsp;&nbsp;&nbsp; string m_FullName;<BR>&nbsp;&nbsp;&nbsp; bool m_IsStdout;<BR>&nbsp;&nbsp;&nbsp; bool m_IsFileOk;&nbsp; <BR>&nbsp;&nbsp;&nbsp; const string getTimeStr(const bool isFileName = false); <BR>};</P>
<P>//CLog.cpp</P>
<P>#include &lt;time.h&gt;<BR>#include "Clog.h"</P>
<P>#define TIMESTAMP(t) ("[" + (t) + "]: ")</P>
<P>CLog::CLog()<BR>{<BR>&nbsp;m_FullName = "./info.log";<BR>&nbsp;&nbsp;&nbsp; m_IsFileOk=true;<BR>&nbsp;&nbsp;&nbsp; m_IsStdout=false;<BR>&nbsp;&nbsp;&nbsp; FILE* fi;<BR>&nbsp;&nbsp;&nbsp; fi = fopen(m_FullName.c_str(), "a");<BR>}<BR>CLog::CLog(const string dir)<BR>{<BR>&nbsp;m_FullName=dir;<BR>&nbsp;&nbsp;&nbsp; m_IsFileOk=true;<BR>&nbsp;&nbsp;&nbsp; m_IsStdout=false;<BR>&nbsp;&nbsp;&nbsp; FILE* fi;<BR>&nbsp;&nbsp;&nbsp; fi = fopen(m_FullName.c_str(), "w");<BR>}<BR>&nbsp;<BR>const string CLog::getTimeStr(const bool isFileName)<BR>{<BR>&nbsp; time_t now;<BR>&nbsp; struct tm * ti; // timeinfo<BR>&nbsp; now = time(NULL);<BR>&nbsp; ti = localtime(&amp;now);<BR>&nbsp; <BR>&nbsp; char buf[200];<BR>&nbsp; /// the string in format "YYYY-MM-dd_hh-mm-ss"<BR>&nbsp; sprintf(buf, isFileName?("%d-%02d-%02d_%02d-%02d-%02d"):("%d-%02d-%02d %02d:%02d:%02d"), <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ti-&gt;tm_year + 1900, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ti-&gt;tm_mon + 1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ti-&gt;tm_mday,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ti-&gt;tm_hour,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ti-&gt;tm_min, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ti-&gt;tm_sec );<BR>&nbsp; return string(buf);<BR>}<BR>void CLog::log(const string title, const string desc)<BR>{<BR>&nbsp;<BR>&nbsp;&nbsp;log(title + " -- " + desc);</P>
<P>}<BR>void CLog::log(const string &amp;text)<BR>{<BR>&nbsp; if( m_FullName != "" &amp;&amp; !m_IsFileOk ) return;<BR>&nbsp; (*this) &lt;&lt; text;<BR>}<BR>CLog &amp;CLog::operator &lt;&lt; ( const char *text)<BR>{<BR>&nbsp; if( m_FullName != "")<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!m_IsFileOk ) return *this;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FILE* fi;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi = fopen(m_FullName.c_str(), "a");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (fi != NULL) <BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char buf[500];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcpy(buf, TIMESTAMP(getTimeStr()).c_str());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcat(buf, text);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcat(buf, "\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fwrite(buf, sizeof(char), strlen(buf), fi);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fclose(fi);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp; }<BR>&nbsp; else <BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; fprintf(m_IsStdout?stdout:stderr, "%s%s\n", TIMESTAMP(getTimeStr()).c_str(), text);<BR>&nbsp; }<BR>&nbsp; return *this;<BR>}<BR>CLog &amp;CLog::operator &lt;&lt; ( const string &amp;text)<BR>{<BR>&nbsp; return (*this)&lt;&lt; text.c_str();<BR>}<BR>CLog &amp;CLog::operator &lt;&lt; ( const int value)<BR>{<BR>&nbsp; char tmp[100];<BR>&nbsp; sprintf(tmp, "%d", value);<BR>&nbsp; return (*this)&lt;&lt; tmp;<BR>}<BR>CLog &amp;CLog::operator &lt;&lt; ( const unsigned int value)<BR>{<BR>&nbsp; char tmp[100];<BR>&nbsp; sprintf(tmp, "%d", value);<BR>&nbsp; return (*this)&lt;&lt; tmp;<BR>}<BR>CLog &amp;CLog::operator &lt;&lt; ( const float value)<BR>{<BR>&nbsp; char tmp[100];<BR>&nbsp; sprintf(tmp, "%-f", value);<BR>&nbsp; return (*this)&lt;&lt; tmp;<BR>}<BR>CLog &amp;CLog::operator &lt;&lt; ( const double value)<BR>{<BR>&nbsp; char tmp[100];<BR>&nbsp; sprintf(tmp, "%-f", value);<BR>&nbsp; return (*this)&lt;&lt; tmp;<BR>}</P>
<P>//test.cpp</P>
<P>#include "Clog.h"<BR>#include &lt;iostream&gt;</P>
<P>int main()<BR>{<BR>&nbsp;CLog lg;<BR>&nbsp;const string m="c:\\book\\test.cpp";<BR>&nbsp;const string n="connect error";<BR>&nbsp;for(int i=0;i&lt;10;i++)<BR>&nbsp;{<BR>&nbsp;&nbsp;lg.log(m,n); <BR>&nbsp;}<BR>&nbsp;&nbsp;cin &gt;&gt; i;<BR>&nbsp;for (int j=0;j&lt;i;j++)<BR>&nbsp;{<BR>&nbsp;&nbsp;lg.log(m,n);<BR>&nbsp;}</P>
<P>}<BR></P>]]></description>
</item><item>
<title><![CDATA[类的继承与组合]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17090</link>
<author>莹莹</author>
<pubDate>2006/8/1 10:49:36</pubDate>
<description><![CDATA[
<H1 style="PAGE-BREAK-BEFORE: always; MARGIN: 8.75pt 0pt"><A name=_Toc520634057><FONT size=3><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第</SPAN><SPAN lang=EN-US>10</SPAN></FONT></A><FONT size=3><SPAN style="mso-bookmark: _Toc520634057"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">章</SPAN> </SPAN><SPAN style="mso-bookmark: _Toc520634057"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类的继承与组合</SPAN></SPAN></FONT></H1>
<P class=MsoNormal><SPAN lang=EN-US>&nbsp;</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象（</SPAN><SPAN lang=EN-US>Object</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）是类（</SPAN><SPAN lang=EN-US>Class</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）的一个实例（</SPAN><SPAN lang=EN-US>Instance</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）。如果将对象比作房子，那么类就是房子的设计图纸。所以面向对象设计的重点是类的设计，而不是对象的设计。</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对于</SPAN><SPAN lang=EN-US>C++</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序而言，设计孤立的类是比较容易的，难的是正确设计基类及其派生类。本章仅仅论述“继承”（</SPAN><SPAN lang=EN-US>Inheritance</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）和“组合”（</SPAN><SPAN lang=EN-US>Composition</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）的概念。</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注意，当前面向对象技术的应用热点是</SPAN><SPAN lang=EN-US>COM</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US>CORBA</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，这些内容超出了</SPAN><SPAN lang=EN-US>C++</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">教材的范畴，请阅读</SPAN><SPAN lang=EN-US>COM</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US>CORBA</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">相关论著。</SPAN></P>
<H2><A name=_Toc520634058><SPAN lang=EN-US><FONT size=3>10.1 </FONT></SPAN></A><SPAN style="mso-bookmark: _Toc520634058"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"><FONT size=3>继承</FONT></SPAN></SPAN></H2>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果</SPAN><SPAN lang=EN-US>A</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是基类，</SPAN><SPAN lang=EN-US>B</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</SPAN><SPAN lang=EN-US>A</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的派生类，那么</SPAN><SPAN lang=EN-US>B</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将继承</SPAN><SPAN lang=EN-US>A</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的数据和函数。例如：</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>class A</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US>{</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>public:</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>void<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Func1(void);</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>void<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Func2(void);</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt"><SPAN lang=EN-US>};</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt"><SPAN lang=EN-US>&nbsp;<?XML:NAMESPACE PREFIX = O /><O:P></O:P></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN lang=EN-US>class B : public A</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US>{</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>public:</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>void<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Func3(void);</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>void<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Func4(void);</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt"><SPAN lang=EN-US>};</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt"><SPAN lang=EN-US>&nbsp;<O:P></O:P></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>main()</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US>{</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>B<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>b;<SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>b.Func1();<SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>// B</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">从</SPAN><SPAN lang=EN-US>A</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">继承了函数</SPAN><SPAN lang=EN-US>Func1</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>b.Func2();<SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>// B</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">从</SPAN><SPAN lang=EN-US>A</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">继承了函数</SPAN><SPAN lang=EN-US>Func2</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>b.Func3();</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>b.Func4();</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN lang=EN-US>}</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN lang=EN-US>&nbsp;<O:P></O:P></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这个简单的示例程序说明了一个事实：</SPAN><SPAN lang=EN-US>C++</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的“继承”特性可以提高程序的可复用性。正因为“继承”太有用、太容易用，才要防止乱用“继承”。我们应当给“继承”立一些使用规则。</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN lang=EN-US>&nbsp;<O:P></O:P></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt; TEXT-INDENT: -21pt; mso-list: l4 level1 lfo124; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings">l<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">【规则</SPAN><SPAN lang=EN-US>10-1-1</SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">】</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果类</SPAN><SPAN lang=EN-US>A</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和类</SPAN><SPAN lang=EN-US>B</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">毫不相关，不可以为了使</SPAN><SPAN lang=EN-US>B</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的功能更多些而让</SPAN><SPAN lang=EN-US>B</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">继承</SPAN><SPAN lang=EN-US>A</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的功能和属性。不要觉得“白吃白不吃”，让一个好端端的健壮青年无缘无故地吃人参补身体。</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt; TEXT-INDENT: -21pt; mso-list: l4 level1 lfo124; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings">l<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">【规则</SPAN><SPAN lang=EN-US>10-1-2</SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">】</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">若在逻辑上</SPAN><SPAN lang=EN-US>B</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</SPAN><SPAN lang=EN-US>A</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的“一种”（</SPAN><SPAN lang=EN-US>a kind of </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">），则允许</SPAN><SPAN lang=EN-US>B</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">继承</SPAN><SPAN lang=EN-US>A</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的功能和属性。例如男人（</SPAN><SPAN lang=EN-US>Man</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）是人（</SPAN><SPAN lang=EN-US>Human</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）的一种，男孩（</SPAN><SPAN lang=EN-US>Boy</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）是男人的一种。那么类</SPAN><SPAN lang=EN-US>Man</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以从类</SPAN><SPAN lang=EN-US>Human</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">派生，类</SPAN><SPAN lang=EN-US>Boy</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以从类</SPAN><SPAN lang=EN-US>Man</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">派生。</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>class Human<O:P></O:P></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">{<O:P></O:P></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>…<O:P></O:P></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">};<O:P></O:P></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>class Man : public Human<O:P></O:P></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">{<O:P></O:P></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>…<O:P></O:P></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">};<O:P></O:P></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>class Boy : public Man<O:P></O:P></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">{<O:P></O:P></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>…<O:P></O:P></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">};<O:P></O:P></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>&nbsp;<O:P></O:P></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 21pt; TEXT-INDENT: -21pt; mso-list: l38 level1 lfo118; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings; mso-bidi-font-weight: bold">u<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注意事项</SPAN><SPAN lang=EN-US><O:P></O:P></SPAN></B></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">【规则</SPAN><SPAN lang=EN-US>10-1-2</SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">】</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">看起来很简单，但是实际应用时可能会有意外，继承的概念在程序世界与现实世界并不完全相同。</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">例如从生物学角度讲，鸵鸟（</SPAN><SPAN lang=EN-US>Ostrich</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）是鸟（</SPAN><SPAN lang=EN-US>Bird</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）的一种，按理说类</SPAN><SPAN lang=EN-US>Ostrich</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应该可以从类</SPAN><SPAN lang=EN-US>Bird</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">派生。但是鸵鸟不能飞，那么</SPAN><SPAN lang=EN-US>Ostrich::Fly</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是什么东西？</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>class Bird</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>{</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>public:<SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>virtual void Fly(void);</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>…</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>};</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>&nbsp;<O:P></O:P></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>class Ostrich : public Bird</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>{</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>…</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>};</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>&nbsp;<O:P></O:P></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">例如从数学角度讲，圆（</SPAN><SPAN lang=EN-US>Circle</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）是一种特殊的椭圆（</SPAN><SPAN lang=EN-US>Ellipse</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">），按理说类</SPAN><SPAN lang=EN-US>Circle</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应该可以从类</SPAN><SPAN lang=EN-US>Ellipse</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">派生。但是椭圆有长轴和短轴，如果圆继承了椭圆的长轴和短轴，岂非画蛇添足？</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所以更加严格的继承规则应当是：<B>若在逻辑上</B></SPAN><B><SPAN lang=EN-US>B</SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</SPAN><SPAN lang=EN-US>A</SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的“一种”，并且</SPAN><SPAN lang=EN-US>A</SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的所有功能和属性对</SPAN><SPAN lang=EN-US>B</SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而言都有意义，则允许</SPAN><SPAN lang=EN-US>B</SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">继承</SPAN><SPAN lang=EN-US>A</SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的功能和属性。</SPAN></B></P>
<H2><A name=_Toc520634059><SPAN lang=EN-US><FONT size=3>10.2 </FONT></SPAN></A><SPAN style="mso-bookmark: _Toc520634059"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"><FONT size=3>组合</FONT></SPAN></SPAN></H2>
<P class=MsoNormal style="MARGIN-LEFT: 21pt; TEXT-INDENT: -21pt; mso-list: l4 level1 lfo124; tab-stops: list 21.0pt"><SPAN lang=EN-US style="FONT-FAMILY: Wingdings">l<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">【规则</SPAN><SPAN lang=EN-US>10-2-1</SPAN></B><B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">】</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">若在逻辑上</SPAN><SPAN lang=EN-US>A</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</SPAN><SPAN lang=EN-US>B</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的“一部分”（</SPAN><SPAN lang=EN-US>a part of</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">），则不允许</SPAN><SPAN lang=EN-US>B</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">从</SPAN><SPAN lang=EN-US>A</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">派生，而是要用</SPAN><SPAN lang=EN-US>A</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和其它东西组合出</SPAN><SPAN lang=EN-US>B</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">例如眼（</SPAN><SPAN lang=EN-US>Eye</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）、鼻（</SPAN><SPAN lang=EN-US>Nose</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）、口（</SPAN><SPAN lang=EN-US>Mouth</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）、耳（</SPAN><SPAN lang=EN-US>Ear</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）是头（</SPAN><SPAN lang=EN-US>Head</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）的一部分，所以类</SPAN><SPAN lang=EN-US>Head</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应该由类</SPAN><SPAN lang=EN-US>Eye</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>Nose</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>Mouth</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>Ear</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">组合而成，不是派生而成。如示例</SPAN><SPAN lang=EN-US>10-2-1</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所示。</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21pt"><SPAN lang=EN-US>&nbsp;<O:P></O:P></SPAN></P>
<TABLE style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; MARGIN-LEFT: 5.4pt; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0pt 5.4pt 0pt 5.4pt" cellSpacing=0 cellPadding=0 border=1>
<TBODY>
<TR>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0pt; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 212.6pt; PADDING-TOP: 0pt; BORDER-BOTTOM: windowtext 0.5pt solid" vAlign=top width=283>
<P class=MsoNormal><SPAN lang=EN-US>class Eye</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>{<BR><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>public:</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US>void<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Look(void);<SPAN style="mso-tab-count: 1">&nbsp; </SPAN></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>};</SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0pt; BORDER-LEFT: medium none; WIDTH: 218pt; PADDING-TOP: 0pt; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-left-alt: solid windowtext .5pt" vAlign=top width=291>
<P class=MsoNormal><SPAN lang=EN-US>class Nose</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>{<BR><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>public:</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US>void<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Smell(void);<SPAN style="mso-tab-count: 1"> </SPAN></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>};</SPAN></P></TD></TR>
<TR>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0pt; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 212.6pt; PADDING-TOP: 0pt; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=283>
<P class=MsoNormal><SPAN lang=EN-US>class Mouth</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>{<BR><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>public:</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US>void<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Eat(void);<SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>};</SPAN></P></TD>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0pt; BORDER-LEFT: medium none; WIDTH: 218pt; PADDING-TOP: 0pt; BORDER-BOTTOM: windowtext 0.5pt solid; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=291>
<P class=MsoNormal><SPAN lang=EN-US>class Ear</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>{<BR><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>public:</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US>void<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Listen(void);<SPAN style="mso-tab-count: 1"> </SPAN></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>};</SPAN></P></TD></TR>
<TR style="HEIGHT: 35pt">
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0pt; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 430.6pt; PADDING-TOP: 0pt; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 35pt; mso-border-top-alt: solid windowtext .5pt" vAlign=top width=574 colSpan=2>
<P class=MsoNormal><SPAN lang=EN-US>// </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">正确的设计，虽然代码冗长。</SPAN><SPAN lang=EN-US> </SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>class Head</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>{</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>public:</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>void <SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Look(void)<SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>m_eye.Look();<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>}</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>void <SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Smell(void)<SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>m_nose.Smell();<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>}</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>void <SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Eat(void)<SPAN style="mso-tab-count: 1"> </SPAN>{<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>m_mouth.Eat();<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>}</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>void <SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Listen(void)<SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>{<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>m_ear.Listen();<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>}</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>private:</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Eye<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>m_eye;</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Nose<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN>m_nose;</SPAN></P>
<P class=MsoDate><SPAN lang=EN-US style="mso-bidi-font-size: 12.0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Mouth<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><SPAN style="mso-tab-count: 1"></SPAN>m_mouth;<O:P></O:P></SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Ear<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>m_ear;</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US>};</SPAN></P></TD></TR></TBODY></TABLE>
<P class=MsoNormal style="TEXT-INDENT: 21pt; TEXT-ALIGN: center" align=center><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt">示例</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">10-2-1 Head</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt">由</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">Eye</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt">、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">Nose</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt">、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">Mouth</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt">、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">Ear</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt">组合而成</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt"><O:P></O:P></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt; TEXT-ALIGN: left" align=left><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果允许</SPAN><SPAN lang=EN-US>Head</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">从</SPAN><SPAN lang=EN-US>Eye</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>Nose</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>Mouth</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>Ear</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">派生而成，那么</SPAN><SPAN lang=EN-US>Head</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将自动具有</SPAN><SPAN lang=EN-US>Look</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US> Smell</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>Eat</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>Listen</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这些功能。示例</SPAN><SPAN lang=EN-US>10-2-2</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">十分简短并且运行正确，但是这种设计方法却是不对的。</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt; TEXT-ALIGN: left" align=left><SPAN lang=EN-US>&nbsp;<O:P></O:P></SPAN></P>
<TABLE style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; MARGIN-LEFT: 5.4pt; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0pt 5.4pt 0pt 5.4pt" cellSpacing=0 cellPadding=0 border=1>
<TBODY>
<TR>
<TD style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0pt; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 430.6pt; PADDING-TOP: 0pt; BORDER-BOTTOM: windowtext 0.5pt solid" vAlign=top width=574>
<P class=MsoNormal style="TEXT-ALIGN: left" align=left><SPAN lang=EN-US><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>// </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">功能正确并且代码简洁，但是设计方法不对。</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt; TEXT-ALIGN: left" align=left><SPAN lang=EN-US>class Head : public Eye, public Nose, public Mouth, public Ear</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt; TEXT-ALIGN: left" align=left><SPAN lang=EN-US>{</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 22.4pt; mso-char-indent-count: 2.0; mso-char-indent-size: 11.2pt"><SPAN lang=EN-US>};</SPAN></P></TD></TR></TBODY></TABLE>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt; TEXT-ALIGN: center" align=center><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt">示例</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">10-2-2<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Head</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt">从</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">Eye</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt">、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">Nose</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt">、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">Mouth</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt">、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; mso-bidi-font-size: 12.0pt">Ear</SPAN><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt">派生而成</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN lang=EN-US>&nbsp;<O:P></O:P></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一只公鸡使劲地追打一只刚下了蛋的母鸡，你知道为什么吗？</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">因为母鸡下了鸭蛋。</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 21.25pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">很多程序员经不起“继承”的诱惑而犯下设计错误。“运行正确”的程序不见得是高质量的程序，此处就是一个例证。</SPAN></P>]]></description>
</item><item>
<title><![CDATA[运算符重载ppt]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17088</link>
<author>莹莹</author>
<pubDate>2006/8/1 10:15:15</pubDate>
<description><![CDATA[<IMG src="http://blogger.org.cn/blog/images/file/zip.gif" border=0><A href="http://blogger.org.cn/blog/uploadfile/200681101659940.RAR" target=_blank>运算符重载.rar</A>]]></description>
</item><item>
<title><![CDATA[Google to Host Open Source Projects]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17080</link>
<author>莹莹</author>
<pubDate>2006/8/1 8:52:42</pubDate>
<description><![CDATA[
<DIV id=intelliTxt>
<P>Google announced plans Thursday at the O'Reilly Open Source Convention in Portland, Ore. to provide hosting for open source projects. While the effort may seem to compete with offerings such as SourceForge.net, the search giant says its intentions are not to replace those services.</P>
<P>The project hosting service would be available through <A href="http://code.google.com/" target=_blank><FONT color=#273595>Google Code</FONT></A>, the company's repository for various APIs and developer tools that can be used to add Google services to applications.</P>
<P></P></DIV>
<DIV style="FLOAT: left; MARGIN-RIGHT: 8px" align=left><IFRAME marginWidth=0 marginHeight=0 src="http://ads.betanews.com/adserve.iframe/www.betanews.com/MPU@Top?1086099992" frameBorder=0 noResize width=336 scrolling=no height=280>
<script language="javascript" src="http://ads.betanews.com/adserve.iframejscript/www.betanews.com/MPU@Top?1086099992"></script>
</IFRAME></DIV>
<DIV id=intelliTxt>Hosting with the service will provide users with a project workspace, version control, issue tracking capabilities, and a mailing list provided by the Google Groups service. Unlike many of Google's beta products, anyone would be allowed to apply for an account immediately. 
<P></P>
<P>"One of our goals is to encourage healthy, productive open source communities," Google said in its <A href="http://code.google.com/hosting/faq.html" target=_blank><FONT color=#273595>FAQ</FONT></A> describing the new service. "Developers can always benefit from more choices in project hosting."</P>
<P>Google's hosting service may not be for everybody, however. The company said it had no plans to offer shell accounts, a build farm, private projects, nested projects, or multiple alternatives for each type of hosted tool anytime soon. Still, the company feels that some of the features within the product could attract developers.</P>
<P>Those behind the project, Google open source engineer Greg Stein and open source program manager Chris DiBona, <A href="http://www.newsforge.com/article.pl?sid=06/07/27/1833251" target=_blank><FONT color=#273595>told NewsForge</FONT></A> Thursday that the service provides a "brand new look" at issue tracking, and leverages the company's strengths in text search to enhance the overall service.</P>
<P>To prevent those from co-opting a project on SourceForge, Google has obtained a list of project names to prevent such an occurrence. Google relies "rely on the goodwill of open source participants to ensure they are the rightful owner or creator of a project name," it said.</P>
<P>Unlike SourceForge, Web hosting will not be provided, although Google plans to eventually enable a file download feature. Accounts will only be awarded to projects licensed under seven programs: the Apache license, Artistic License, GNU General Public License (GPL), Lesser General Public License (LGPL), Mozilla License, BSD license, and MIT licenses.</P>
<P>"The open source community has been flooded with lots of nearly identical licenses," Google explained in its decision to only support seven license structures. "We'd like to see projects standardize on the most popular, time-tested ones," it said.</P></DIV>]]></description>
</item><item>
<title><![CDATA[System Administrator Appreciation Day]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17065</link>
<author>莹莹</author>
<pubDate>2006/7/31 15:26:09</pubDate>
<description><![CDATA[
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2><STRONG>System Administrator Appreciation Day</STRONG></FONT></P>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1><EM>If you can read this, thank your sysadmin</EM></FONT></P>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>A sysadmin unpacked the server for this website from its box, installed an operating system, patched it for security, made sure the power and air conditioning was working in the server room, monitored it for stability, set up the software, and kept backups in case anything went wrong. All to serve this webpage.</FONT></P>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>A sysadmin installed the routers, laid the cables, configured the networks, set up the firewalls, and watched and guided the traffic for each hop of the network that runs over copper, fiber optic glass, and even the air itself to bring the Internet to your computer. All to make sure the webpage found its way from the server to your computer.</FONT></P>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1></FONT></P>
<TABLE align=right>
<TBODY>
<TR>
<TD width=203><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1><STRONG><IMG height=204 alt="Ted in wires" src="http://www.sysadminday.com/images/tedwires200.jpg" width=200 border=1></STRONG></FONT></TD></TR>
<TR>
<TD>
<DIV align=center><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1><EM>Fig. 1 Ted.</EM></FONT></DIV></TD></TR></TBODY></TABLE>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>A sysadmin makes sure your network connection is safe, secure, open, and working. A sysadmin makes sure your computer is working in a healthy way on a healthy network. A sysadmin takes backups to guard against disaster both human and otherwise, holds the gates against security threats and crackers, and keeps the printers going no matter how many copies of the tax code someone from Accounting prints out.</FONT></P>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1></FONT></P>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>A sysadmin worries about spam, viruses, spyware, but also power outages, fires and floods.</FONT></P>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>When the email server goes down at 2 AM on a Sunday, your sysadmin is paged, wakes up, and goes to work.</FONT></P>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>A sysadmin is a professional, who plans, worries, hacks, fixes, pushes, advocates, protects and creates good computer networks, to get you your data, to help you do work -- to bring the potential of computing ever closer to reality.</FONT></P>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>So if you can read this, thank your sysadmin -- and know she is only one of dozens or possibly hundreds whose work brings you the email from your aunt on the West Coast, the instant message from your son at college, the free phone call from the friend in Australia, and this webpage.</FONT></P>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1><STRONG>Show your appreciation</STRONG></FONT></P>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>Friday, July 28th, 2006, is the 7th annual System Administrator Appreciation Day. On this special international day, give your System Administrator something that shows that you truly appreciate their hard work and dedication.</FONT></P>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>Let's face it, System Administrators get no respect 364 days a year. This is the day that all fellow System Administrators across the globe, will be showered with expensive sports cars and large piles of cash in appreciation of their diligent work. But seriously, we are asking for a nice token gift and some public acknowledgement. It's the least you could do. </FONT></P>
<P><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1>Consider all the daunting tasks and long hours (weekends too.) Let's be honest, sometimes we don't know our System Administrators as well as they know us. Remember this is one day to recognize your System Administrator for their workplace contributions and to promote professional excellence. Thank them for all the things they do for you and your business.</FONT></P>]]></description>
</item><item>
<title><![CDATA[时装周]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17043</link>
<author>莹莹</author>
<pubDate>2006/7/30 21:05:56</pubDate>
<description><![CDATA[<P>白色，当所有的色彩融化在一起的时候就成为了白色，她是光明，得天真的，优雅的，浪漫的。但同时也可能是炫耀的，浮浅的，无个性的......无论怎么样，白色主导着整个2006年的夏天，它是毫无疑问压倒一切的主角。这个夏天，白色可能是一段维多利亚女王式的白色花边，可能是奥黛丽赫本在电影里穿着的一件同居男友的大号白衬衫，也可能是列农之妻大野洋子爱戴的一顶白色礼帽......</P>
<P>&nbsp;&nbsp; 喜爱穿纯白色的女子，会让自己误以为看起来低调纯情，其实恰恰相反，纯白色的表现欲最为强烈，在所有颜色中是最出风头的，也有可能，最为性感。而，由为什么不呢？</P>
<P>&nbsp;&nbsp; 米白色会给白色带来一丝楚楚动人柔弱之感，会白色则会带来神秘莫测的气质。&nbsp; </P>
<P>&nbsp;&nbsp;&nbsp; 懂得不同那个音调白色的表现语言，才能混合出想要表达的自我个性。</P>
<P>水漾艳阳</P>
<P>&nbsp; 2006年的夏天，有如热带雨林般浓烈的浮华的色调不再流行，取而代之的是以充满质感的纯白，肤色，和金色，结合淡淡的彩色与暖煦光芒，制造出透明、清新、自然而又质感的浪漫妆容。</P>
<P>&nbsp;</P>
<P>&nbsp;</P>]]></description>
</item><item>
<title><![CDATA[还有多少王子可以点惦记]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17041</link>
<author>莹莹</author>
<pubDate>2006/7/30 20:16:40</pubDate>
<description><![CDATA[<P>没有人永远童年，可是永远有人童年。</P>
<P>&nbsp; 没有人永远童年，可是我们对童年的渴望永远。</P>
<P>&nbsp; 没有人永远童年，可是我们可以永远保持一份真纯的童心。</P>
<P>&nbsp; 永远的童话我们永远去读，</P>
<P>&nbsp; 永远的童话爱情我们永远期待。。。。。。</P>
<P>&nbsp; 在和王子的爱情里，零和不如双赢。</P>
<P>&nbsp; 爱情也是游戏，是游戏就有规则，就有输赢。在零和规律下，输赢就是盘子里的葡萄，赢家多吃了一颗，输家就要少吃一颗，一个人失去的恰巧是另一个人得到的。</P>
<P>&nbsp; 日本太子妃叫小和田雅子，原本出身于外交世家，教育良好，容貌秀丽，爱好广泛，11年前嫁给日本的德仁太子。但是，尊贵的皇太子妃的身份，并没有使她更加快乐，取而代之的是无穷无尽的烦恼。</P>
<P>&nbsp; 她的才华已渐渐被人们遗忘，为了丈夫、即为皇室传宗接代成了她人生的头等大事。尽管已经生下了小公主爱子，但根据日本战后宪法，只有男性可以继承王位，他的压力依旧。雅子在2003年年底曾经宣布，她已经因此感到精疲力尽，决定免除自己在皇室的职务。</P>
<P>&nbsp; 之后，她甚至不看重副导离开皇宫，搬回自己的娘家居住。日本皇室官员甚至表示，他们也不知道她什么时候会返回皇宫。虽然近来德仁太子曾经探访过她两次，但他大多数时间也只能住在附近的酒店里。</P>
<P>&nbsp;&nbsp; 假如某一天，德仁太子终于能够如愿以偿地得到一位皇太子，那他的所得，恰好是小和田雅子的所失，她失去了那么多年的快乐、以及才华释放的机会。</P>
<P>&nbsp; 而双赢，先是一种哲学意识，之后才运用于市场经济。 </P>
<P>&nbsp; 约旦王后拉妮娅被誉为“阿拉伯世界的戴安娜”，她是世界上最年轻的王后，美艳照人学识丰富，婚前是苹果计算机公司的职员。拉妮娅很现代，喜欢上网，喜欢看电影，喜欢搞文学创作，喜欢打品牌的应季时装。她的行为不居一格，时间充裕的时候，她常自己驾车带家人到外面野餐，时间不充裕的时候，麦当劳餐厅也常常能迎来她的光顾。</P>
<P>&nbsp;&nbsp; 她每天的工作只要是治理于解决国家爱的贫穷和妇女问题，他积极参与慈善活动、去科索沃探望难民，还对企图侵吞难民救援物资的国际犯罪团伙给予严厉的痛斥，他要担当起作为一国之后的许多责任。虽然每天都在阿卜杜拉身边，但她从不越俎代庖，只是尽力做阿卜杜拉的好妻子，做丈夫的好外交牌照。</P>
<P>&nbsp;&nbsp; 婚姻让她更有光彩，她在婚姻里找到了自我的价值，并且协助国王更好地管理了自己的国家。</P>
<P>&nbsp;&nbsp; 如果把小和田雅和拉妮娅比较起来，拉妮娅生活的环境似乎更保守和更具宗教的色彩，这里的妇女甚至被禁止开车，更不用说参与政务了。但是，性格决定命运，拉妮娅敢于面对争议，她的做事风格和处事原则也得到了丈夫的支持，这才让她有机会向世界展示了自己多角度的魅力。</P>
<P>&nbsp;&nbsp;&nbsp; 和王子的真正爱情，就该是微软的cpu和浏览器，双赢！ </P>
<P>&nbsp;</P>
<P>&nbsp;</P>]]></description>
</item><item>
<title><![CDATA[就这么简单]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17039</link>
<author>莹莹</author>
<pubDate>2006/7/30 19:29:38</pubDate>
<description><![CDATA[<SPAN class=dl170><IMG onmousewheel="return bbimg(this)" height=551 src="http://www.womanfriend.com/Article/UploadFiles/200606/20060627161310911.jpg" width=418 onload=javascript:resizepic(this) border=0></SPAN>]]></description>
</item><item>
<title><![CDATA[纯色]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17038</link>
<author>莹莹</author>
<pubDate>2006/7/30 19:21:18</pubDate>
<description><![CDATA[<SPAN class=dl170><IMG onmousewheel="return bbimg(this)" height=542 src="http://www.womanfriend.com/Article/UploadFiles/200606/20060627160413682.jpg" width=414 onload=javascript:resizepic(this) border=0></SPAN>]]></description>
</item><item>
<title><![CDATA[明朗]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17037</link>
<author>莹莹</author>
<pubDate>2006/7/30 19:19:56</pubDate>
<description><![CDATA[<SPAN class=dl170><IMG onmousewheel="return bbimg(this)" height=541 src="http://www.womanfriend.com/Article/UploadFiles/200606/20060627161056435.jpg" width=425 onload=javascript:resizepic(this) border=0></SPAN>]]></description>
</item><item>
<title><![CDATA[绚烂花期]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17036</link>
<author>莹莹</author>
<pubDate>2006/7/30 19:08:29</pubDate>
<description><![CDATA[<SPAN class=dl170><IMG onmousewheel="return bbimg(this)" height=551 src="http://www.womanfriend.com/Article/UploadFiles/200607/20060704142744190.jpg" width=420 onload=javascript:resizepic(this) border=0></SPAN>]]></description>
</item><item>
<title><![CDATA[紫罗兰花开]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=莹莹&amp;id=17035</link>
<author>莹莹</author>
<pubDate>2006/7/30 18:58:46</pubDate>
<description><![CDATA[<P><SPAN class=dl170><IMG onmousewheel="return bbimg(this)" height=551 src="http://www.womanfriend.com/Article/UploadFiles/200607/20060704142140599.jpg" width=420 onload=javascript:resizepic(this) border=0></SPAN></P>]]></description>
</item>
</channel>
</rss>