锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产亚洲在线,欧美日韩三级电影在线,亚洲特色特黄http://www.shnenglu.com/firehutter/category/2700.html闆曟爮鐜夌爩搴旂姽鍦紝鍙槸鏈遍鏀?/description>zh-cnMon, 19 May 2008 21:55:40 GMTMon, 19 May 2008 21:55:40 GMT60C++瀛︿範(fàn)絎旇錛氱被緇ф壙涓叧浜庤櫄鍑芥暟鍜屽姩鎬佽仈緙栫殑鍑犵偣闂http://www.shnenglu.com/firehutter/archive/2006/11/29/15785.html鐖變笂闈掕彍鐨勫寘瀛?/dc:creator>鐖變笂闈掕彍鐨勫寘瀛?/author>Wed, 29 Nov 2006 09:27:00 GMThttp://www.shnenglu.com/firehutter/archive/2006/11/29/15785.htmlhttp://www.shnenglu.com/firehutter/comments/15785.htmlhttp://www.shnenglu.com/firehutter/archive/2006/11/29/15785.html#Feedback0http://www.shnenglu.com/firehutter/comments/commentRss/15785.htmlhttp://www.shnenglu.com/firehutter/services/trackbacks/15785.html鐪嬭搗鏉ワ紝鍦ㄥぇ澶氭暟鎯呭喌涓嬶紝鍔ㄦ佽仈緙栭兘鏇村ソ錛屽洜涓哄畠璁╃▼搴忚兘澶熼夋嫨涓虹壒瀹氱被鍨嬭璁$殑鏂規(guī)硶錛岃繖鏍烽棶棰樺氨鏉ヤ簡(jiǎn)錛屾棦鐒跺姩鎬佽仈緙栬繖涔堝ソ錛屼負(fù)浠涔堣繕瑕佽璁′袱縐嶇被鍨嬬殑鑱旂紪錛熶負(fù)浠涔堥粯璁ょ殑鑱旂紪鏂規(guī)硶鏄潤(rùn)鎬佺殑鑰屼笉鏄姩鎬侊紵

鍘熷洜鍏抽敭灝卞湪浜庢晥鐜囥係trousstrup璇磋繃錛堝緢緇忓吀錛屽懙鍛碉級(jí)錛欳++鐨勬寚瀵煎師鍒欎箣涓鏄紝涓嶈涓轟笉浣跨敤鐨勭壒鎬т粯鍑轟唬浠鳳紙鍐呭瓨鎴栧鐞嗘椂闂達(dá)級(jí)銆?br />
鍥犱負(fù)閫氬父鎯呭喌涓嬶紝緙栬瘧鍣ㄥ鐞嗚櫄鍑芥暟鐨勬柟娉曚負(fù)錛氱粰姣忎釜瀵硅薄娣誨姞涓涓殣钘忔垚鍛橈紝璇ユ垚鍛樹(shù)腑淇濆瓨?shù)簡(jiǎn)涓涓寚鍚戝嚱鏁板湴鍧鏁扮粍鐨勬寚閽堬紙縐頒負(fù)铏氬嚱鏁拌〃 virtual function table,vtbl錛夈傝櫄鍑芥暟琛ㄤ腑瀛樺偍浜?jiǎn)湄?fù)綾誨璞¤繘琛屽0鏄庣殑铏氬嚱鏁扮殑鍦板潃銆備緥濡傦紝鍩虹被鍖呭惈涓涓寚閽堬紝鎸囧悜浜?jiǎn)鍩壕c諱腑鎵鏈夎櫄鍑芥暟鐨勫湴鍧琛紝媧劇敓綾誨璞″皢鍖呭惈涓涓寚鍚戠嫭绔嬪湴鍧琛ㄧ殑鎸囬拡錛屽鏋滄淳鐢熺被鎻愪緵浜?jiǎn)铏氬嚱鏁扮殑鏂板畾涔夊Q岃铏氬嚱鏁拌〃灝嗕繚瀛樻柊鍑芥暟鐨勫湴鍧錛屽鏋滄病鏈夐噸鏂板畾涔夛紝鍒欎繚鐣欏師濮嬬増鏈殑鍦板潃銆傝皟鐢ㄨ櫄鍑芥暟鏃訛紝紼嬪簭灝嗘煡鐪嬪瓨鍌ㄥ湪瀵硅薄涓殑vtbl鍦板潃錛岀劧鍚庤漿鍚戠浉搴旂殑鍑芥暟鍦板潃琛ㄣ?br />
鎵浠ユ樉鑰屾槗瑙佺殑鏄紝浣跨敤铏氬嚱鏁版椂錛屽湪鍐呭瓨鍜屾墽琛岄熷害鏂歸潰鏈変竴瀹氱殑棰濆鎴愭湰錛屽寘鎷細(xì)
姣忎釜瀵硅薄閮藉皢澧炲ぇ錛屽澶ч噺涓哄瓨鍌ㄥ湴鍧鐨勭┖闂達(dá)紱瀵規(guī)瘡涓被錛岀紪璇戝櫒閮藉垱寤轟竴涓櫄鍑芥暟鍦板潃琛紙鏁扮粍錛夛紱姣忎釜鍑芥暟璋冪敤閮介渶瑕佹墽琛屼竴姝ラ澶栫殑鎿嶄綔錛屽嵆鍒拌〃涓煡鎵懼湴鍧銆?br />
鎵浠ュ挶浠鍏繪垚鐨勪範(fàn)鎯槸錛屽湪璁捐綾繪椂錛屽彲鑳藉寘鍚竴浜涗笉鍦ㄦ淳鐢熺被閲嶆柊瀹氫箟鐨勬垚鍛樺嚱鏁幫紝閭d箞榪欎簺鍑芥暟灝變笉瑕佽緗負(fù)铏氬嚱鏁般傝繖鏍烽鍏堜細(xì)鏈夋洿濂界殑鏁堢巼錛屽叾嬈¤澹版槑涓鴻櫄鍑芥暟鐨勬垚鍛樺嚱鏁板氨琛ㄦ槑鏄鏈熷湪媧劇敓綾諱腑浼?xì)琚噸鏂板畾涔夌殑锛屽湪闃呰M唬鐮佹椂涔熷皢姣旇緝鏂逛究銆?img src ="http://www.shnenglu.com/firehutter/aggbug/15785.html" width = "1" height = "1" />

]]>
榪欎袱澶╃敤C++Builder鏃剁鍒頒竴鐐歸棶棰橈紝鍏充簬TQuary鐨?/title><link>http://www.shnenglu.com/firehutter/archive/2006/10/26/14255.html</link><dc:creator>鐖變笂闈掕彍鐨勫寘瀛?/dc:creator><author>鐖變笂闈掕彍鐨勫寘瀛?/author><pubDate>Thu, 26 Oct 2006 13:25:00 GMT</pubDate><guid>http://www.shnenglu.com/firehutter/archive/2006/10/26/14255.html</guid><wfw:comment>http://www.shnenglu.com/firehutter/comments/14255.html</wfw:comment><comments>http://www.shnenglu.com/firehutter/archive/2006/10/26/14255.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/firehutter/comments/commentRss/14255.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/firehutter/services/trackbacks/14255.html</trackback:ping><description><![CDATA[ <p>榪欏嚑澶╂嬁鍒板叕鍙鎬互鍓嶉」鐩腑鐨勪竴涓敤C++Builder鍋氱殑紼嬪簭錛屽湪鎴戞満鍣ㄤ笂璋冭瘯錛岀粨鏋滄彁紺哄嚭閿欙細(xì)Operation not applicable</p> <p>浣跨敤鏂偣璺熻釜涔嬪悗鍙戠幇閿欒鍑哄湪浣跨敤TQuery鏃舵墽琛宱pen鏂規(guī)硶鏃訛紝鍥炶拷鏍規(guī)簮錛屽緱鍑轟互涓嬪弽棣堬細(xì)<br /></p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #000000">m_pqQuery</span> <span style="COLOR: #000000">-></span> <span style="COLOR: #000000">SQL</span> <span style="COLOR: #000000">-></span> <span style="COLOR: #000000">Add(聽(tīng)</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">Select聽(tīng)*聽(tīng)From聽(tīng)Table1聽(tīng)Where聽(tīng)I(yíng)d聽(tīng)=聽(tīng):PId聽(tīng)</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽(tīng));<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />m_pqQuery</span> <span style="COLOR: #000000">-></span> <span style="COLOR: #000000">ParamByName(聽(tīng)</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">PId</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽(tīng))</span> <span style="COLOR: #000000">-></span> <span style="COLOR: #000000">AsInteger聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽(tīng)鏌愪釜int鍙橀噺;</span> </div> <p> <br />鎵ц瀹岃繖鍙ヤ箣鍚庯紝鎸夋甯告儏鍐碉紝鍙傛暟PId搴旇琚祴浜堜簡(jiǎn)涓涓暣褰㈠鹼紝浣嗘槸Debug璺熻釜鏄劇ず鍏跺艱繕鏄窡鏈祴鍊煎墠鏄悓鏍瘋〃紺虹殑鏈煡鍊箋傛墍浠ュ湪鎵цopen鏂規(guī)硶鏃跺嚭閿欎簡(jiǎn)銆?/p> <p>濡傛灉鎴戜笉鏄敤璇ユ柟娉曪紝鐩存帴鎶奡QL璇彞鍐欐錛?br /></p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #000000">m_pqQuery</span> <span style="COLOR: #000000">-></span> <span style="COLOR: #000000">SQL</span> <span style="COLOR: #000000">-></span> <span style="COLOR: #000000">Add(聽(tīng)</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">Select聽(tīng)*聽(tīng)From聽(tīng)Table1聽(tīng)Where聽(tīng)I(yíng)d聽(tīng)=聽(tīng)0聽(tīng)</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽(tīng));</span> </div> <p> <br />榪愯姝e父</p> <p>鎴栬呯敤<br /></p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #0000ff">char</span> <span style="COLOR: #000000">聽(tīng)sql[</span> <span style="COLOR: #000000">80</span> <span style="COLOR: #000000">];<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span> <span style="COLOR: #0000ff">int</span> <span style="COLOR: #000000">聽(tīng)n聽(tīng)</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽(tīng)鏌愭暣褰㈠彉閲徛?<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />sprintf(sql,</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">Select聽(tīng)*聽(tīng)From聽(tīng)Table1聽(tīng)Where聽(tīng)I(yíng)d聽(tīng)=聽(tīng)%d</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">,n);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" />pqQuery</span> <span style="COLOR: #000000">-></span> <span style="COLOR: #000000">SQL</span> <span style="COLOR: #000000">-></span> <span style="COLOR: #000000">Add(sql);</span> </div> <p> <br />涔熻繍琛屾甯?/p> <p>鏌ヤ簡(jiǎn)涓嬶紝鍘熸潵緇欏弬鏁拌祴鍊肩殑鏂規(guī)硶騫舵病鏈夐敊璇紝緙栬瘧涔熻兘閫氳繃錛屽喌涓斾互鍓嶈紼嬪簭鑲畾鏄兘姝e父榪愯鐨勩傘傜湡鏄鎬負(fù)浠涔堝湪鎴戣繖閲屽氨璧嬩笉涓婂箋傘傝皟璇曚簡(jiǎn)寰堜箙涔熸病鑳芥壘鍒板師鍥狅紝鍙ソ浣滅艦錛屼負(fù)浜?jiǎn)椤哄埄杩愯锛屽彧鑳芥敼湄?fù)sprintf鍜岀洿鎺ヨ繛鎺ュ瓧絎︿覆鐨勬柟寮忋?br />鍦ㄨ繖閲岃涓婁竴絎旓紝甯屾湜浠ュ悗鑳藉鎵懼埌鍘熷洜銆傘傘?br /></p> <img src ="http://www.shnenglu.com/firehutter/aggbug/14255.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/firehutter/" target="_blank">鐖變笂闈掕彍鐨勫寘瀛?/a> 2006-10-26 21:25 <a href="http://www.shnenglu.com/firehutter/archive/2006/10/26/14255.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>C++瀛︿範(fàn)絎旇錛氱被涓庡姩鎬佸唴瀛樺垎閰嶄腑鍚勭闂鐨勯樁孌墊ф葷粨http://www.shnenglu.com/firehutter/archive/2006/09/28/13111.html鐖變笂闈掕彍鐨勫寘瀛?/dc:creator>鐖變笂闈掕彍鐨勫寘瀛?/author>Thu, 28 Sep 2006 07:18:00 GMThttp://www.shnenglu.com/firehutter/archive/2006/09/28/13111.htmlhttp://www.shnenglu.com/firehutter/comments/13111.htmlhttp://www.shnenglu.com/firehutter/archive/2006/09/28/13111.html#Feedback1http://www.shnenglu.com/firehutter/comments/commentRss/13111.htmlhttp://www.shnenglu.com/firehutter/services/trackbacks/13111.html
  • 閲嶈澆<<鎿嶄綔絎?br />瑕侀噸鏂板畾涔?lt;<鎿嶄綔絎︼紝浠ヤ究灝嗗畠鍜宑out涓璧風(fēng)敤鏉ユ樉紺哄璞$殑鍐呭錛岃瀹氫箟涓嬮潰鐨勫弸鍏冩搷浣滅鍑芥暟錛?
    ostream聽(tīng)&聽(tīng)operator聽(tīng)<<聽(tīng)(ostream聽(tīng)&聽(tīng)os,const聽(tīng)c_name聽(tīng)&聽(tīng)obj)
    {
    os聽(tīng)
    <<聽(tīng);//聽(tīng)display聽(tīng)object聽(tīng)contents
    return聽(tīng)os;
    }

    鍏朵腑c_name鏄被鍚嶃傚鏋滆綾繪彁渚涗簡(jiǎn)鑳藉榪斿洖鎵闇鍐呭鐨勫叕鏈夋柟娉曪紝鍒欏彲鍦ㄦ搷浣滅鍑芥暟涓嬌鐢ㄨ繖浜涙柟娉曪紝榪欐牱渚夸笉浼?xì)灏嗕粬浠畡〗负鍙嬪厓鍑芥曨C簡(jiǎn)銆?br />
  • 杞崲鍑芥暟
    瑕佸皢鍗曚釜鍊艱漿鎹負(fù)綾葷被鍨嬶紝闇瑕佸垱寤哄師鍨嬪涓嬫墍紺虹殑綾繪瀯閫犲嚱鏁幫細(xì)
    c_name(type_name聽(tīng)value);

    鍏朵腑c_name涓虹被鍚嶏紝type_name鏄杞崲鐨勭被鍨嬬殑鍚嶇О銆?br />瑕佸皢綾昏漿鎹負(fù)鍏朵粬綾誨瀷錛岄渶瑕佸垱寤哄師鍨嬪涓嬫墍紺虹殑綾繪垚鍛樺嚱鏁幫細(xì)
    operator聽(tīng)type_name();

    铏界劧璇ュ嚱鏁版病鏈夊0鏄庤繑鍥炵被鍨嬶紝浣嗗簲榪斿洖鎵闇綾誨瀷鐨勫箋?br />浣跨敤杞崲鍑芥暟鏃惰灝忓績(jī)銆傚彲浠ュ湪澹版槑鏋勯犲嚱鏁版椂浣跨敤鍏抽敭瀛梕xplicit錛屼互闃叉瀹冭鐢ㄤ簬闅愬紡杞崲銆?br />
  • 鍏舵瀯閫犲嚱鏁頒嬌鐢╪ew鐨勭被
    濡傛灉綾諱嬌鐢╪ew鎿嶄綔絎︽潵鍒嗛厤綾繪垚鍛樻寚鍚戠殑鍐呭瓨錛屽湪璁捐鏃跺簲閲囧彇涓浜涢闃叉帾鏂姐?
    • 瀵逛簬鎸囧悜鐨勫唴瀛樻槸鐢眓ew鍒嗛厤鐨勬墍鏈夌被鎴愬憳錛岄兘搴斿湪綾葷殑鏋愭瀯鍑芥暟涓鍏朵嬌鐢╠elete錛岃鎿嶄綔絎﹀皢閲婃斁鍒嗛厤鐨勫唴瀛樸?
    • 濡傛灉鏋愭瀯鍑芥暟閫氳繃瀵規(guī)寚閽堢被鎴愬憳?shù)娇鐢╠elete鏉ラ噴鏀懼唴瀛橈紝鍒欐瘡涓瀯閫犲嚱鏁伴兘搴斿綋浣跨敤new鏉ュ垵濮嬪寲鎸囬拡錛屾垨灝嗗畠璁劇疆涓虹┖鎸囬拡銆?
    • 鏋勯犲嚱鏁頒腑瑕佷箞浣跨敤new[]錛岃涔堜嬌鐢╪ew錛岃屼笉鑳芥販鐢ㄣ傚鏋滄瀯閫犲嚱鏁頒嬌鐢ㄧ殑鏄痭ew[]錛屽垯鏋愭瀯鍑芥暟搴斾嬌鐢╠elete[]錛涘鏋滄瀯閫犲嚱鏁頒嬌鐢ㄧ殑鏄痭ew錛屽垯鏋愭瀯鍑芥暟搴旈傜敤delete銆?
    • 搴斿畾涔変竴涓垎閰嶅唴瀛橈紙鑰屼笉鏄皢鎸囬拡鎸囧悜宸叉湁鍐呭瓨錛夌殑澶嶅埗鏋勯犲嚱鏁般傝繖鏍風(fēng)▼搴忚兘澶熷皢綾誨璞″垵濮嬪寲涓哄彟涓涓璞°傝繖縐嶆瀯閫犲嚱鏁板師鍨嬪涓嬶細(xì)
      className(const聽(tīng)className聽(tīng)&)
    • 搴斿畾涔変竴涓噸杞借祴鍊兼搷浣滅鐨勭被鎴愬憳鍑芥暟錛屽叾鍑芥暟瀹氫箟濡備笅錛堝叾涓璫_pointer鏄痗_name鐨勭被鎴愬憳錛岀被鍨嬩負(fù)鎸囧悜type_name鐨勬寚閽堬級(jí)銆備笅闈㈢殑鑼冧緥鍋囪浣跨敤new[]鏉ュ垵濮嬪寲鍙橀噺c_pointer錛夛細(xì)
      c_name聽(tīng)&聽(tīng)c_name::operator聽(tīng)=聽(tīng)(const聽(tīng)c_name聽(tīng)&聽(tīng)cn)
      {
      if聽(tīng)(this聽(tīng)==聽(tīng)&聽(tīng)cn)
      return聽(tīng)*this;

      delete聽(tīng)[]聽(tīng)c_pointer;
      //聽(tīng)set聽(tīng)size聽(tīng)number聽(tīng)of聽(tīng)type_name聽(tīng)units聽(tīng)to聽(tīng)be聽(tīng)copyied
      c_pointer聽(tīng)=聽(tīng)new聽(tīng)type_name[size];
      //聽(tīng)then聽(tīng)copy聽(tīng)data聽(tīng)pointed聽(tīng)to聽(tīng)by聽(tīng)cn.c_pointer聽(tīng)to
      //聽(tīng)location聽(tīng)pointed聽(tīng)to聽(tīng)by聽(tīng)c_pointer

      return聽(tīng)*this;
      }

    鏈枃瀵規(guī)垜鍓嶉潰鍑犵瘒闅忕瑪涓彁鍒扮殑闂?shù)篃浣滃囖Z簡(jiǎn)涓涓葷粨錛屾劅瑙夊緢鏈夊繀瑕佽涓嬫潵銆?br />浠ヤ笂鍐呭鍘熸枃寮曠敤鑷弬鑰冧功綾嶄腑鍐呭銆?br />
    鍙傝冧功綾嶏細(xì)C++PrimerPlus author:Stephen Prata



    ]]>
    C++瀛︿範(fàn)絎旇錛氬叧浜嶤++綾諱笌鍔ㄦ佸唴瀛樺垎閰嶄腑甯冨眬new鎿嶄綔絎?/title><link>http://www.shnenglu.com/firehutter/archive/2006/09/28/13107.html</link><dc:creator>鐖變笂闈掕彍鐨勫寘瀛?/dc:creator><author>鐖變笂闈掕彍鐨勫寘瀛?/author><pubDate>Thu, 28 Sep 2006 06:42:00 GMT</pubDate><guid>http://www.shnenglu.com/firehutter/archive/2006/09/28/13107.html</guid><wfw:comment>http://www.shnenglu.com/firehutter/comments/13107.html</wfw:comment><comments>http://www.shnenglu.com/firehutter/archive/2006/09/28/13107.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/firehutter/comments/commentRss/13107.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/firehutter/services/trackbacks/13107.html</trackback:ping><description><![CDATA[ <p>聽(tīng)</p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #0000ff">const</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #0000ff">int</span> <span style="COLOR: #000000">聽(tīng)BUF聽(tīng)</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #000000">512</span> <span style="COLOR: #000000">聽(tīng);<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span> <span style="COLOR: #0000ff">class</span> <span style="COLOR: #000000">聽(tīng)JustTesting<br /><img id="Codehighlighter1_41_157_Open_Image" onclick="this.style.display='none'; Codehighlighter1_41_157_Open_Text.style.display='none'; Codehighlighter1_41_157_Closed_Image.style.display='inline'; Codehighlighter1_41_157_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_41_157_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_41_157_Closed_Text.style.display='none'; Codehighlighter1_41_157_Open_Image.style.display='inline'; Codehighlighter1_41_157_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span> <span id="Codehighlighter1_41_157_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.shnenglu.com/images/dot.gif" /> </span> <span id="Codehighlighter1_41_157_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)</span> <span style="COLOR: #0000ff">private</span> <span style="COLOR: #000000">:<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)JustTesting(</span> <span style="COLOR: #0000ff">const</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #0000ff">string</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #000000">&</span> <span style="COLOR: #000000">聽(tīng)s聽(tīng)</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">Just聽(tīng)Testing</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">,</span> <span style="COLOR: #0000ff">int</span> <span style="COLOR: #000000">聽(tīng)n聽(tīng)</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #000000">0</span> <span style="COLOR: #000000">)<br /><img id="Codehighlighter1_114_118_Open_Image" onclick="this.style.display='none'; Codehighlighter1_114_118_Open_Text.style.display='none'; Codehighlighter1_114_118_Closed_Image.style.display='inline'; Codehighlighter1_114_118_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_114_118_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_114_118_Closed_Text.style.display='none'; Codehighlighter1_114_118_Open_Image.style.display='inline'; Codehighlighter1_114_118_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)</span> <span id="Codehighlighter1_114_118_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.shnenglu.com/images/dot.gif" /> </span> <span id="Codehighlighter1_114_118_Open_Text"> <span style="COLOR: #000000">{<img src="http://www.shnenglu.com/images/dot.gif" />}</span> </span> <span style="COLOR: #000000">聽(tīng)<br /><img id="Codehighlighter1_137_141_Open_Image" onclick="this.style.display='none'; Codehighlighter1_137_141_Open_Text.style.display='none'; Codehighlighter1_137_141_Closed_Image.style.display='inline'; Codehighlighter1_137_141_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_137_141_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_137_141_Closed_Text.style.display='none'; Codehighlighter1_137_141_Open_Image.style.display='inline'; Codehighlighter1_137_141_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)</span> <span style="COLOR: #000000">~</span> <span style="COLOR: #000000">JustTesting()</span> <span id="Codehighlighter1_137_141_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.shnenglu.com/images/dot.gif" /> </span> <span id="Codehighlighter1_137_141_Open_Text"> <span style="COLOR: #000000">{<img src="http://www.shnenglu.com/images/dot.gif" />}</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)</span> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000">:<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)<img src="http://www.shnenglu.com/images/dot.gif" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span> </span> <span style="COLOR: #000000">;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align="top" /></span> <span style="COLOR: #0000ff">int</span> <span style="COLOR: #000000">聽(tīng)main()<br /><img id="Codehighlighter1_172_565_Open_Image" onclick="this.style.display='none'; Codehighlighter1_172_565_Open_Text.style.display='none'; Codehighlighter1_172_565_Closed_Image.style.display='inline'; Codehighlighter1_172_565_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_172_565_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_172_565_Closed_Text.style.display='none'; Codehighlighter1_172_565_Open_Image.style.display='inline'; Codehighlighter1_172_565_Open_Text.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span> <span id="Codehighlighter1_172_565_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.shnenglu.com/images/dot.gif" /> </span> <span id="Codehighlighter1_172_565_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)</span> <span style="COLOR: #0000ff">char</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #000000">*</span> <span style="COLOR: #000000">聽(tīng)buffer聽(tīng)</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #0000ff">new</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #0000ff">char</span> <span style="COLOR: #000000">聽(tīng)[BUF];<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)JustTesting聽(tīng)</span> <span style="COLOR: #000000">*</span> <span style="COLOR: #000000">pc1,</span> <span style="COLOR: #000000">*</span> <span style="COLOR: #000000">pc2,</span> <span style="COLOR: #000000">*</span> <span style="COLOR: #000000">pc3,</span> <span style="COLOR: #000000">*</span> <span style="COLOR: #000000">pc4;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)pc1聽(tīng)</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #0000ff">new</span> <span style="COLOR: #000000">聽(tīng)(buffer)聽(tīng)JustTesting;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)pc2聽(tīng)</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #0000ff">new</span> <span style="COLOR: #000000">聽(tīng)JustTesting(聽(tīng)</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽(tīng)Heap1聽(tīng)</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽(tīng),聽(tīng)</span> <span style="COLOR: #000000">20</span> <span style="COLOR: #000000">聽(tīng));<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)pc3聽(tīng)</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #0000ff">new</span> <span style="COLOR: #000000">聽(tīng)(buffer聽(tīng)</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #0000ff">sizeof</span> <span style="COLOR: #000000">聽(tīng)(JustTesting))聽(tīng)JustTesting(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">Bad聽(tīng)I(yíng)dea</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">,</span> <span style="COLOR: #000000">6</span> <span style="COLOR: #000000">);聽(tīng)聽(tīng)</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">聽(tīng)姝ゅ鐢ㄤ竴涓狫ustTesging瀵硅薄澶у皬鐨勫亸縐婚噺閬垮厤pc3涓巔c1鍗犵敤鍚屼竴鍧楀唴瀛橈紝鍥犱負(fù)濡傛灉綾誨姩鎬佺殑涓哄叾鎴愬憳鍒嗛厤鍐呭瓨錛屽崰鐢ㄥ悓涓鍐呭瓨灝嗕細(xì)浜х敓闂銆偮?/span> <span style="COLOR: #008000"> <br /> <img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span> <span style="COLOR: #000000">聽(tīng)聽(tīng)聽(tīng)聽(tīng)pc4聽(tīng)</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #0000ff">new</span> <span style="COLOR: #000000">聽(tīng)JustTesting(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">Heap2</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">,</span> <span style="COLOR: #000000">10</span> <span style="COLOR: #000000">)聽(tīng)<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)<img src="http://www.shnenglu.com/images/dot.gif" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)delete聽(tīng)pc2;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)delete聽(tīng)pc4;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)delete聽(tīng)[]聽(tīng)buffer;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/InBlock.gif" align="top" />聽(tīng)聽(tīng)聽(tīng)聽(tīng)</span> <span style="COLOR: #0000ff">return</span> <span style="COLOR: #000000">聽(tīng)</span> <span style="COLOR: #000000">0</span> <span style="COLOR: #000000">;<br /><img src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span> </span> </div> <p> <br />浠ヤ笂浠g爜鐗囨柇涓紝pc1鍜宲c3涓哄竷灞new鎿嶄綔絎︽潵鍒嗛厤鍐呭瓨錛岃宲c2鍜宲c4涓哄父瑙刵ew鎿嶄綔絎︽潵鍒嗛厤鍐呭瓨聽(tīng)銆?br />瀵逛簬甯歌new鎿嶄綔絎﹀垎閰嶇殑鍐呭瓨錛屽彲浠ョ洿鎺ヤ嬌鐢細(xì)<span style="COLOR: #000000"><span id="npx319d" class="Code"><span style="COLOR: #000000">delete聽(tīng)pc2; </span></span></span>榪欐牱鐨勮鍙ユ搷浣滄潵閲婃斁鍐呭瓨銆?br /><br />鑰屽浜庡竷灞new鎿嶄綔絎﹀垎閰嶇殑鍐呭瓨灝變笉鑳借繖鏍峰仛錛?span style="COLOR: #000000"><span id="pvb3n9b" class="Code"><span style="COLOR: #000000">delete聽(tīng)pc1;</span></span></span></p> <p>鍥犱負(fù)pc1鍜宲c3騫舵病鏈夌洿鎺ユ敹鍒皀ew鎿嶄綔絎﹁繑鍥炵殑鍦板潃錛岃屾槸鐢卞竷灞鎿嶄綔絎︽寚鍚戜簡(jiǎn)buffer鐨勫湴鍧錛宯ew/delete緋葷粺鐭ラ亾宸插垎閰嶇殑512瀛楄妭鍧梑uffer錛屼絾瀵瑰竷灞new鎿嶄綔絎﹀璇ュ唴瀛樺潡鍋氫簡(jiǎn)浣曠澶勭悊涓鏃犳墍鐭ャ?br />鍙︿竴鏂歸潰錛宐uffer鐨勫湴鍧鏄敤<font color="#000000"><span id="fzj1r11" class="Code">new []</span>鍒濆鍖栫殑錛屽洜姝ゅ繀欏諱嬌鐢?span class="Code">delete[]</span>鑰屼笉鏄?span class="Code">delete</span></font>銆?br /><font color="#ff0000">娉ㄦ剰錛氬嵆浣縝uffer鏄嬌鐢╪ew鑰屼笉鏄痭ew[]鍒濆鍖栫殑錛?span class="Code">delete pc1 </span>涔熷皢閲婃斁buffer錛岃屼笉鏄痯c1銆?/font></p> <p>浠ヤ笂鐨勪唬鐮佺‘瀹為噴鏀句簡(jiǎn)buffer錛?font color="#000000"><span id="p1n9jjz" class="Code">delete [] buffer;</span><br /></font>浣嗘槸鐢辨浜х敓浜?jiǎn)鏂扮殑闂锛屽畠娌℃湁湄?fù)甯冨眬new鎿嶄綔絎﹀湪璇ュ唴瀛樺潡涓垱寤虹殑瀵硅薄璋冪敤鏋愭瀯鍑芥暟錛屾垜浠彧闇瑕佸湪鏋愭瀯鍑芥暟涓斁鍏ヤ竴孌墊樉紺鴻鍙ュ氨鍙互娓呮鐨勭湅鍒幫紝紼嬪簭騫舵病鏈夐攢姣佲淛ustTesting鈥濆拰鈥淏ad Idea鈥濓紝涔熷氨鏄痯c1鍜宲c3鎸囧悜鐨勫璞°?br />閭d箞榪欓噷灝遍渶瑕佹垜浠樉寮忕殑涓哄竷灞new鎿嶄綔絎﹀垱寤虹殑瀵硅薄璋冪敤鏋愭瀯鍑芥暟銆傛甯告儏鍐典笅灝嗚嚜鍔ㄨ皟鐢ㄦ瀽鏋勫嚱鏁幫紝<font color="#ff0000">榪欐槸闇瑕佹樉紺鴻皟鐢ㄦ瀽鏋勫嚱鏁扮殑灝戞暟鍑犵鎯呭喌涔嬩竴銆?/font><br />鏄懼紡璋冪敤鏋愭瀯鍑芥暟鏃訛紝蹇呴』鎸囧畾瑕侀攢姣佺殑瀵硅薄銆傜敱浜庢湁鎸囧悜瀵硅薄鐨勬寚閽堬紝鍥犳鍙互榪欐牱鍐欙細(xì)</p> <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 95%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <div> <span id="_162_532_Open_Text"> <span style="COLOR: #000000">pc3->~JustTesting();<br />pc1->~JustTesting();</span> </span> </div> </div> <p>鎶婅繖孌典唬鐮佹斁鍒?span class="Code">delete [] buffer;</span>涔嬪墠錛岃繖孌電▼搴忔墠綆楀畬鏁存棤閿欍?/p> <p>鍙傝冧功綾嶏細(xì)C++PrimerPlus author:Stephen Prata<br /></p> <img src ="http://www.shnenglu.com/firehutter/aggbug/13107.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/firehutter/" target="_blank">鐖變笂闈掕彍鐨勫寘瀛?/a> 2006-09-28 14:42 <a href="http://www.shnenglu.com/firehutter/archive/2006/09/28/13107.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>C++瀛︿範(fàn)絎旇錛氬湪鏋勯犲嚱鏁頒腑浣跨敤new鏃跺簲娉ㄦ剰鐨勪簨欏?/title><link>http://www.shnenglu.com/firehutter/archive/2006/09/28/13106.html</link><dc:creator>鐖變笂闈掕彍鐨勫寘瀛?/dc:creator><author>鐖變笂闈掕彍鐨勫寘瀛?/author><pubDate>Thu, 28 Sep 2006 06:41:00 GMT</pubDate><guid>http://www.shnenglu.com/firehutter/archive/2006/09/28/13106.html</guid><wfw:comment>http://www.shnenglu.com/firehutter/comments/13106.html</wfw:comment><comments>http://www.shnenglu.com/firehutter/archive/2006/09/28/13106.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/firehutter/comments/commentRss/13106.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/firehutter/services/trackbacks/13106.html</trackback:ping><description><![CDATA[ <p>鍦ㄤ嬌鐢╪ew鏉ュ垵濮嬪寲瀵硅薄鐨勬寚閽堟垚鍛樻椂蹇呴』鐗瑰埆灝忓績(jī)錛屼互涓嬫槸鍑犵偣娉ㄦ剰浜嬮」錛?/p> <ul> <li>濡傛灉鍦ㄦ瀯閫犲嚱鏁頒腑浣跨敤new鏉ュ垵濮嬪寲鎸囬拡鎴愬憳錛屽垯搴斿湪鏋愭瀯鍑芥暟涓嬌鐢╠elete銆? </li> <li>new鍜宒elete蹇呴』鐩鎬簰鍏煎銆俷ew瀵瑰簲浜巇elete錛宯ew[]瀵瑰簲浜巇elete[]銆? </li> <li>濡傛灉鏈夊涓瀯閫犲嚱鏁幫紝鍒欏繀欏諱互鐩稿悓鐨勬柟寮忎嬌鐢╪ew錛岃涔堥兘甯︿腑鎷彿錛岃涔堥兘涓嶅甫銆傚洜涓哄彧鏈変竴涓瀽鏋勫嚱鏁幫紝鍥犳鎵鏈夌殑鏋勯犲嚱鏁伴兘蹇呴』涓庡畠鍏煎銆?font color="#ff0000">涓嶈繃鍙互鍦ㄤ竴涓瀯閫犲嚱鏁頒腑浣跨敤new鏉ュ垵濮嬪寲鎸囬拡錛岃屽湪鍙﹀涓涓瀯閫犲嚱鏁頒腑灝嗘寚閽堝垵濮嬪寲涓虹┖錛圢ull鎴?錛夛紝榪欐槸鍥犱負(fù)delete錛堟棤璁烘槸甯︿腑鎷彿榪樻槸涓嶅甫涓嫭鍙鳳級(jí)鍙互鐢ㄤ簬絀烘寚閽堛?/font></li> </ul> <img src ="http://www.shnenglu.com/firehutter/aggbug/13106.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/firehutter/" target="_blank">鐖變笂闈掕彍鐨勫寘瀛?/a> 2006-09-28 14:41 <a href="http://www.shnenglu.com/firehutter/archive/2006/09/28/13106.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>C++瀛︿範(fàn)絎旇錛欳++綾誨拰鍔ㄦ佸唴瀛樺垎閰嶄腑鍏充簬澶嶅埗鏋勯犲嚱鏁板拰璧嬪兼搷浣滅http://www.shnenglu.com/firehutter/archive/2006/09/28/13103.html鐖變笂闈掕彍鐨勫寘瀛?/dc:creator>鐖變笂闈掕彍鐨勫寘瀛?/author>Thu, 28 Sep 2006 06:33:00 GMThttp://www.shnenglu.com/firehutter/archive/2006/09/28/13103.htmlhttp://www.shnenglu.com/firehutter/comments/13103.htmlhttp://www.shnenglu.com/firehutter/archive/2006/09/28/13103.html#Feedback0http://www.shnenglu.com/firehutter/comments/commentRss/13103.htmlhttp://www.shnenglu.com/firehutter/services/trackbacks/13103.html渚嬪鏈変互涓媍lass錛?/p>
    class 聽(tīng)StringBad
    {
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)
    private :
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
    char 聽(tīng) * 聽(tīng)str;
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
    int 聽(tīng)len;
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)
    public :
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)StringBad(
    const 聽(tīng) char 聽(tīng) * 聽(tīng)s);
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)StringBad();
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
    ~ StringBad();
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
    }
    ;

    鍦ㄦ瀯閫犲嚱鏁板拰鏋愭瀯鍑芥暟瀹氫箟褰撲腑鏈夊涓嬪畾涔夛細(xì)

    StringBad::StringBad( const 聽(tīng) char 聽(tīng) * 聽(tīng)s)
    {
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)len聽(tīng)
    = 聽(tīng)std::strlen(s);
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)str聽(tīng)
    = 聽(tīng) new 聽(tīng) char 聽(tīng)[len聽(tīng) + 聽(tīng) 1 ];
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)
    }
    聽(tīng)

    StringBad::StringBad()
    {
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)len聽(tīng)
    = 聽(tīng) 4 聽(tīng);
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)str聽(tīng)
    = 聽(tīng) new 聽(tīng) char [ 4 ];
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)
    }
    聽(tīng)

    StringBad::
    ~ StringBad()
    {
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)
    聽(tīng)聽(tīng)聽(tīng)聽(tīng)delete聽(tīng)[]聽(tīng)str;
    }

    閭d箞鍦ㄧ▼搴忓綋涓鏋滄湁浠ヤ笅浠g爜錛?/p>

    StringBad聽(tīng)sports( " Spinach聽(tīng)Leaves聽(tīng)Bow1聽(tīng)for聽(tīng)bollars " );
    StringBad聽(tīng)sailor聽(tīng)
    = 聽(tīng)sports;

    浠ヤ笂鐨勭浜屾潯鍒濆鍖栬鍙ュ皢浼?xì)璋冪敤浠涔堟瀯閫犲嚱鏁幫紵璁頒綇錛岃繖縐嶅艦寮忕殑鍒濆鍖栫瓑鏁堜簬涓嬮潰鐨勮鍙ワ細(xì)

    StringBad聽(tīng)sailor聽(tīng) = 聽(tīng)StringBad(sports);

    鍥犱負(fù)sports鐨勭被鍨嬩負(fù)StringBad錛屽洜姝ょ浉搴旂殑鏋勯犲嚱鏁板師鍨嬪簲璇ュ涓嬶細(xì)

    StringBad( const 聽(tīng)StringBad聽(tīng) & );

    褰撴垜浠嬌鐢ㄤ竴涓璞℃潵鍒濆鍖栧彟涓涓璞℃椂錛岀紪璇戝櫒灝嗚嚜鍔ㄧ敓鎴愪笂榪版瀯閫犲嚱鏁幫紙縐頒負(fù)澶嶅埗鏋勯犲嚱鏁幫紝鍥犱負(fù)瀹冨垱寤哄璞$殑涓涓壇鏈級(jí)銆?br />鐜板湪鎴戜滑涓嶅Θ鎬葷粨涓涓嬫墍璋撶殑闅愬紡鎴愬憳鍑芥暟錛屽嵆C++鑷姩鎻愪緵浜?jiǎn)浠ヤ笅杩欎簺鎴愬憳鍑芥晭图?xì)

    • 榛樿鏋勯犲嚱鏁幫紝濡傛灉娌℃湁瀹氫箟鏋勯犲嚱鏁般?
    • 澶嶅埗鏋勯犲嚱鏁幫紝濡傛灉娌℃湁瀹氫箟銆?
    • 璧嬪兼搷浣滅錛屽鏋滄病鏈夊畾涔夈?
    • 榛樿鏋愭瀯鍑芥暟錛屽鏋滄病鏈夊畾涔夈?
    • 鍦板潃鎿嶄綔絎︼紝濡傛灉娌℃湁瀹氫箟銆?

    鐜板湪鎴戜滑鏉ョ湅鐪嬫垜浠病鏈夊畾涔夊鍒舵瀯閫犲嚱鏁扮殑鎯呭喌涓嬭皟鐢ㄩ殣寮忓鍒舵瀯閫犲嚱鏁板皢浼?xì)鍑虹庮C粈涔堟儏鍐點(diǎn)?br />浠庢瀯閫犲嚱鏁板畾涔夌殑浠g爜鐗囨柇鍙互鐪嬪埌錛屽綋涓嬌鐢╪ew鎿嶄綔絎﹀垵濮嬪寲浜?jiǎn)涓涓寚閽坰tr錛岃岄殣寮忕殑澶嶅埗鏋勯犲嚱鏁版槸鎸夊艱繘琛屽鍒剁殑錛岄偅涔堝浜庢寚閽坰tr錛屽皢浼?xì)杩涜濡備笅澶嶅堄灱?xì)

    sailor.str聽(tīng) = 聽(tīng)sports.str;

    榪欓噷澶嶅埗鐨勪笉鏄瓧絎︿覆錛岃屾槸涓涓寚鍚戝瓧絎︿覆鐨勬寚閽堬紒涔熷氨鏄錛屾垜浠皢寰楀埌涓や釜鎸囧悜鍚屼竴涓瓧絎︿覆鐨勬寚閽堬紒鐢辨浼?xì)漶旂敓鐨勯棶棰槥畣涓嵀a鑰屽柣銆傚綋鍏朵腑涓涓璞¤皟鐢ㄤ簡(jiǎn)鏋愭瀯鍑芥暟涔嬪悗錛屽叾str鎸囧悜鐨勫唴瀛樺皢琚噴鏀撅紝榪欎釜鏃跺欐垜浠鏋滆皟鐢ㄥ彟涓涓璞★紝鍏秙tr鎸囧悜鐨勫湴鍧鏁版嵁浼?xì)鏄粈涔堬紵寰堟槑鏄懼皢浼?xì)鍑虹庮C笉鍙鏂欑殑緇撴灉銆?/p>

    鎵浠ョ敱姝ゅ彲瑙侊紝濡傛灉綾諱腑鍖呭惈浜?jiǎn)鋴社敤new鍒濆鍖栫殑鎸囬拡鎴愬憳錛屽簲褰撳畾涔変竴涓鍒舵瀯閫犲嚱鏁幫紝浠ュ鍒舵寚鍚戠殑鏁版嵁錛岃屼笉鏄寚閽堬紝榪欒縐頒負(fù)娣卞害澶嶅埗銆傚洜涓洪粯璁ょ殑嫻呭鍒訛紙鎴栨垚涓烘垚鍛樺鍒訛級(jí)浠呮祬嫻呯殑璧嬪兼寚閽堜俊鎭?/strong>

    鎴戜滑鍐嶇湅浠ヤ笅浠g爜鐗囨柇錛屾垜浠◢鍋氫慨鏀癸細(xì)

    StringBad聽(tīng)headline1( " Celery聽(tīng)Stalks聽(tīng)at聽(tīng)Midnight " );
    StringBad聽(tīng)knot;
    knot聽(tīng)
    = 聽(tīng)headline1;

    榪欓噷鐨勬渶鍚庝竴琛屽皢涓庝互涓婁緥瀛愭湁鎵鍖哄埆錛岀幇鍦ㄦ槸灝嗗凡鏈夊璞¤祴緇欏彟涓涓凡鏈夊璞★紝榪欏皢浼?xì)閲囧彇鍏朵粬鎿嶄綔锛屽嵆鋴社敤閲嶈浇鐨勮祴鍊兼搷浣滅銆傦紙鎴戜滑闇瑕佺煡閬撶殑鏄細(xì)鍒濆鍖栨繪槸浼?xì)璋冪敤澶嶅埗鏋勯犲嚱鏁幫紝鑰屼嬌鐢?鎿嶄綔絎︽椂涔熷彲鑳借皟鐢ㄨ祴鍊兼搷浣滅錛夊洜涓篊++鍏佽瀵硅薄璧嬪鹼紝榪欐槸閫氳繃鑷姩涓虹被閲嶈澆璧嬪兼搷浣滅瀹炵幇鐨勩傚叾鍘熷瀷濡備笅錛?/p>

    Class_name聽(tīng) & 聽(tīng)Class_name:: operator 聽(tīng) = 聽(tīng)( const 聽(tīng)Class_name聽(tīng) & );

    瀹冩帴鍙楀茍榪斿洖涓涓寚鍚戠被瀵硅薄鐨勫紩鐢ㄣ?br />涓庨殣寮忕殑澶嶅埗鏋勯犲嚱鏁頒竴鏍鳳紝闅愬紡鐨勫璞¤祴鍊兼搷浣滅涔熶細(xì)浜х敓鍚屾牱鐨勯棶棰橈紝鍗沖寘鍚簡(jiǎn)浣跨敤new鍒濆鍖栫殑鎸囬拡鎴愬憳鏃訛紝鍙細(xì)閲囩敤嫻呭鍒躲傛墍浠ユ垜浠渶瑕佷嬌鐢ㄥ悓鏍風(fēng)殑瑙e喅鍔炴硶錛?strong>鍗沖畾涔変竴涓噸杞界殑璧嬪兼搷浣滅鏉ュ疄鐜版繁搴﹀鍒躲?/strong>

    鎵浠ョ患涓婃墍榪幫紝濡傛灉綾諱腑鍖呭惈浜?jiǎn)鋴社敤new鍒濆鍖栫殑鎸囬拡鎴愬憳錛屾垜浠簲璇ユ樉寮忓畾涔変竴涓鍒舵瀯閫犲嚱鏁板拰涓涓噸杞界殑璧嬪兼搷浣滅鏉ュ疄鐜板叾娣卞害澶嶅埗錛岄伩鍏嶇敱姝ゅ甫鏉ョ殑鎴愬憳澶嶅埗闂

    鍙傝冧功綾嶏細(xì)C++PrimerPlus author:Stephen Prata



    ]]>
    鍏充簬C++瀛︿範(fàn)絎旇http://www.shnenglu.com/firehutter/archive/2006/09/28/13102.html鐖變笂闈掕彍鐨勫寘瀛?/dc:creator>鐖變笂闈掕彍鐨勫寘瀛?/author>Thu, 28 Sep 2006 06:23:00 GMThttp://www.shnenglu.com/firehutter/archive/2006/09/28/13102.htmlhttp://www.shnenglu.com/firehutter/comments/13102.htmlhttp://www.shnenglu.com/firehutter/archive/2006/09/28/13102.html#Feedback1http://www.shnenglu.com/firehutter/comments/commentRss/13102.htmlhttp://www.shnenglu.com/firehutter/services/trackbacks/13102.html絎旇涓弬鑰冧簡(jiǎn)涓浜涗功綾嶄腑鐨勮寖渚嬪拰涓浜涜鏄庛傞兘鏄嚜宸卞涔?fàn)杩嚱E嬩腑鏁寸悊鍑烘潵鐨勶紝涓昏鐩殑鏄粰鑷繁鏃ュ悗鍙傝冦?img src ="http://www.shnenglu.com/firehutter/aggbug/13102.html" width = "1" height = "1" />

    ]]>
    久久精品国产影库免费看 | 久久久婷婷五月亚洲97号色| 久久亚洲精品成人无码网站| 欧美午夜精品久久久久免费视| 国产精品毛片久久久久久久| 久久国产精品免费一区| 亚洲午夜久久久久久久久电影网 | 国产精品久久久久久福利69堂| 国产精品免费久久久久久久久| 欧美久久久久久| 久久精品成人免费网站| 久久国产亚洲精品| 日本福利片国产午夜久久| 久久只有这里有精品4| 国产福利电影一区二区三区久久老子无码午夜伦不 | 国内高清久久久久久| 国产成人久久精品二区三区| 久久狠狠爱亚洲综合影院| 国产激情久久久久影院老熟女免费| 精品国产乱码久久久久软件| 久久久久亚洲AV成人网人人软件| 99久久精品毛片免费播放| 国内精品久久久久久久久电影网| 老司机午夜网站国内精品久久久久久久久 | 中文字幕久久亚洲一区| 久久99精品九九九久久婷婷| 久久精品www| 国产精品久久久久影视不卡| 国产亚洲精品久久久久秋霞| 一本色道久久综合狠狠躁篇| 色8激情欧美成人久久综合电| 久久精品国产影库免费看 | 东方aⅴ免费观看久久av| 午夜精品久久久久久| 久久精品国产一区二区三区| 亚洲国产精品一区二区久久| 久久噜噜电影你懂的| 91精品观看91久久久久久| 国产成人综合久久精品尤物| 国产精品成人精品久久久| 九九久久精品国产|