Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C/C++ÎÊ´ð(3)£º¹ØÓÚ¹¹ÔìºÍÎö¹¹º¯ÊýʹÓöà̬

ÎÊ£º
ÔÚ¹¹Ôì»òÎö¹¹ÆÚ¼äÄÜʹÓÃÐ麯ÊýÂð£¿
´ð£º
ÄÜ£¬µ«×îºÃ²»ÒªÕâô×ö¡£
Ç°Á½ÌìÔÚ¹«Ë¾ÓÎÏ·ÏîÄ¿¿ª·¢¹ý³ÌÖУ¬ÔÚÎö¹¹º¯ÊýÖв»Ð¡Ðĵ÷ÓÃÁËÐ麯Êý£¬¶øÇÒ»¹ÊǸö´¿Ð麯Êý¡£
ÒòΪһֱÊÇÔÚRleaseģʽϹ¤×÷µÄ£¬µ¼ÖÂϵͳֱ½ÓÖÕÖ¹¿Í»§¶Ë£¬ËäÈ»¿ØÖÆ̨ÓдòÓ¡Õâ¸ö´íÎ󣬵«ÖÕֹ̫¿ì£¬Ò²Ã»¿´µ½¡£Çл»ÔÚDebugϵ÷ÊÔ£¬Ôò»á±¨R6025 -pure virtual function call µÄÔËÐÐʱ´íÎó¡£
µ±È»£¬Èç¹ûÔÚÎö¹¹º¯ÊýÖÐÖ±½Óµ÷Óô¿Ð麯Êý£¬±àÒëÆ÷Ò²²»Éµ(VS2008)£¬Ëü²»»áÈñàÒëͨ¹ýµÄ£¬ÒòΪ´¿Ð麯ÊýûÓÐʵÏÖÌ壬ËùÒÔ»á³öÏÖunresolved external symbolÁ´½Ó´íÎó¡£µ«ÊÇͨ¹ýÆäËûº¯Êý¼ä½Óµ÷Ó㬱àÒëÆ÷¾Í²»»á·¢ÏÖ£¬¾Í»á³ö´í¡£
Ö±½Ó¿´ÏÂÃæÕâ¸öÀý×Ó°É
class TestEffect
{
 public:
  TestEffect(){}
  ~TestEffect(){ release(); }
  void release(){ clear(); }
  virtual void clear() = 0;
};
class SubTestEffect: public TestEffect
{
 public:
  SubTestEffect(){}
  ~SubTestEffect(){}
  virtual void clear(){ printf( "SubTestEffect::clear() called\n" }
};
ÕâÑùnew³öÀ´Ò»¸öSubTestEffectµÄʵÀý£¬ÔÚdeleteʱ¾Í»á±ÀÀ£¡£
¾ÍÕâ¸öÀý×Ó£¬ËµÒ»Ï¹ØÓÚ¹¹ÔìºÍÎöÔ캯ÊýÖÐʹÓöà̬
Ò»¡¢¹¹ÔìÅÉÉúÀà¶ÔÏóʱ£¬Ê×Ïȵ÷ÓûùÀ๹Ô캯Êý£¬Ö´ÐлùÀà³õʼ»¯¡£¶ø¶ÔÏóµÄÅÉÉúÀಿ·ÖÊÇδ³õʼ»¯µÄ¡£Êµ¼ÊÉÏ´Ëʱ¶ÔÏó»¹²»ÊÇÒ»¸öÅÉÉúÀà¶ÔÏó¡£
¶þ¡¢Îö¹¹ÅÉÉúÀà¶ÔÏóʱ£¬Ê×ÏÈÎö¹¹ËüµÄÅÉÉúÀಿ·Ö£¬È»ºó°´ÕÕÓë¹¹Ôì˳ÐòµÄÄæÐòµ÷ÓÃËüµÄ»ùÀàÎö¹¹¡£
ÕâÁ½ÖÖÇé¿öÏ£¬¶ÔÏ󶼲»ÊÇÍêÕûµÄ¡£ÎªÁËÊÊÓ¦ÕâÖÖ²»ÍêÕû£¬±àÒëÆ÷½«¶ÔÏóµÄÀàÐÍÊÓΪÔÚ¹¹Ôì»òÎöÔìÆڼ䷢ÉúÁ˱仯¡£ÔÚ»ùÀ๹Ôì»òÎö¹¹º¯ÊýÖУ¬½«ÅÉÉúÀà¶ÔÏóµ±×÷»ùÀàÀàÐͶÔÏóÀ´¶Ô´ý¡£
¹¹Ôì»òÎö¹¹ÆÚ¼äµÄ¶ÔÏóÀàÐͶÔÐ麯ÊýµÄ°ó¶¨ÓÐÓ°Ïì¡£
ËùÒÔÈç¹ûÔÚ¹¹Ôì»òÎö¹¹º¯ÊýÖÐʹÓöà̬£¬ÔòÔËÐеÄÊÇΪ¹¹Ô캯Êý»òÎö¹¹º¯Êý×ÔÉíÀàÐͶ¨ÒåµÄ°æ±¾¡£ÎÞÂÛÊÇÓɹ¹Ô캯Êý£¨»òÎö¹¹º¯Êý£©Ö±½Óµ÷ÓÃÐ麯Êý£¬»òÕß´Ó¹¹Ô캯Êý£¨»òÎö¹¹º¯Êý£©Ëùµ÷Óõĺ¯Êý¼ä½Óµ÷ÓÃÐ麯Êý£¬¶¼Ó¦ÓÃÕâÖְ󶨡£
¡¶Effective C++¡·µÚÈý°æÖÐÌõ¿î09,Scott Meyers¾ÍÃ÷È·Ö¸³ö£º¾ö²»ÔÚ¹¹Ôì»òÎöÔì¹ý³ÌÖе÷ÓÃvirtualº¯Êý£¬½²µÄÏêϸÇÒȨÍþ¡£ÓÐÈË˵C++³ÌÐòÔ±·ÖΪÁ½À࣬¶Á¹ýEffective C++µÄºÍû¶Á¹ýµÄ£¬ºÜÒź¶£¬ÎÒÊǺóÕß¡£
¸æ½ë×Ô¼º²»ÒªÔÚ¹¹Ôì»òÎö¹¹¹ý³ÌÖе÷ÓÃÐ麯Êý¡£
×¢Ò⣺“²»Òª”ºÍ“²»ÄÜ”£¬ÔÊÐíµ÷Ó㬵«¿ÉÄÜ´ï²»µ½


Ïà¹ØÎĵµ£º

JavaScriptµ÷ÓÃC++º¯Êý

 ÉÏƪ½éÉÜÁËÓÃC++µ÷ÓÃJavaScript£¬Õâƪ·´¹ýÀ´ËµËµJSµ÷C++£¬ÕâÑùJSºÍC++¹µÍ¨µÄ;¾¶¾ÍÍêÕûÁË¡£
Ê×ÏÈ£¬ÊµÏÖÒ»¸öIDispatch½Ó¿Ú£¬µ±JSµ÷ÓÃC++º¯Êýʱ£¬ÏµÍ³»áµ÷ÓÃGetIDsOfNamesÀ´Óú¯ÊýÃûÈ¡µÃº¯ÊýµÄDISPID£¬È»ºóµ÷ÓÃInvokeÍê³ÉÕæÕýµÄµ÷Óã¬ÐèҪעÒâµÄÊÇInvokeµÄpDispParamsÖеIJÎÊýÊǵ¹ÐòµÄ¡£´úÂëÈçÏ£º
class CExtenalDis ......

C/C++Êý×éÃûÓëÖ¸ÕëÇø±ð

 ÒÔÏÂÎÄÕÂתÔØÓÚ:ΪÁËѧϰºÍÊÕ²Ø
http://tech.163.com/school · 2005-08-23 11:05:18 · À´Ô´: Ì켫Íø
C/C++Êý×éÃûÓëÖ¸ÕëÇø±ð
¡¡¡¡ÒýÑÔ
¡¡¡¡Ö¸ÕëÊÇC/C++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇ ......

CÖкê#ºÍ##µÄÔËÓÃ

 #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#define f(a,b) a##b
#define g(a)  #a
#define h(a) g(a)
int main()   
{   
    char a = 'a';      
    ......

C/C++ ³£¼ûÃæÊÔÌâ

 
1.Ö¸ÕëºÍÒýÓÃÓÐʲô·Ö±ð£»Èç¹û´«ÒýÓñȴ«Ö¸Õ밲ȫ£¬ÎªÊ²Ã´£¿Èç¹ûÎÒʹÓó£Á¿Ö¸ÕëÄѵÀ²»ÐÐÂð£¿
     (1) ÒýÓÃÔÚ´´½¨µÄͬʱ±ØÐë³õʼ»¯£¬¼´ÒýÓõ½Ò»¸öÓÐЧµÄ¶ÔÏ󣻶øÖ¸ÕëÔÚ¶¨ÒåµÄʱºò²»±Ø³õʼ»¯£¬¿ÉÒÔÔÚ¶¨ÒåºóÃæµÄÈκεط½ÖØи³Öµ£®
     (2) ²»´æÔڣΣգ̣ÌÒýÓã¬ÒýÓÃ±Ø ......

¹ØÓÚcÖÐvolatile¹Ø¼ü×Ö£¨×ªÌù£©

 Ò»¸ö¶¨ÒåΪvolatileµÄ±äÁ¿ÊÇ˵Õâ±äÁ¿¿ÉÄܻᱻÒâÏë²»µ½µØ¸Ä±ä£¬ÕâÑù£¬±àÒëÆ÷¾Í²»»áÈ¥¼ÙÉèÕâ¸ö±äÁ¿µÄÖµÁË¡£¾«È·µØ˵¾ÍÊÇ£¬ÓÅ»¯Æ÷ÔÚÓõ½Õâ¸ö±äÁ¿Ê±±ØÐëÿ´Î¶¼Ð¡ÐĵØÖØжÁÈ¡Õâ¸ö±äÁ¿µÄÖµ£¬¶ø²»ÊÇʹÓñ£´æÔڼĴæÆ÷ÀïµÄ±¸·Ý¡£ÏÂÃæÊÇvolatile±äÁ¿µÄ¼¸¸öÀý×Ó£º
    1). ²¢ÐÐÉ豸µÄÓ²¼þ¼Ä´æÆ÷£¨È磺״̬¼Ä´æÆ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ