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

c/c++ ×óÖµ ÓÒÖµÌÖÂÛ

×óÖµÐÔ£¨lvalueness£©ÔÚC/C++ÖÐÊDZí´ïʽµÄÒ»¸öÖØÒªÊôÐÔ¡£Ö»ÓÐͨ¹ýÒ»¸ö×óÖµ±í´ïʽ²ÅÄÜÀ´ÒýÓü°¸ü¸ÄÒ»¸ö¶ÔÏó£¨object£©µÄÖµ¡££¨Ä³Ð©Çé¿öÏ£¬ÓÒÖµ±í´ïʽҲÄÜÒýÓã¨refer£©µ½Ä³Ò»¸ö¶ÔÏ󣬲¢ÇÒ¿ÉÄܼä½ÓÐ޸ĸöÔÏóµÄÖµ£¬ºóÊö£©¡£
    ºÎν¶ÔÏó£¿Èç¹ûûÓÐÃ÷ȷ˵Ã÷£¬ÕâÀï˵µÄ¶ÔÏ󣬺ÍÏÁÒåµÄÀà/¶ÔÏó£¨class/object£©Ïà±È£¬¸üΪ¹ã·º¡£ÔÚC/C++ÖУ¬ËùνµÄ¶ÔÏóÖ¸µÄÊÇÖ´Ðл·¾³ÖÐÒ»¿é´æ´¢ÇøÓò£¨a region of storage£©£¬¸Ã´æ´¢ÇøÓòÖеÄÄÚÈÝÔò´ú±í£¨represent£©Á˸öÔÏóµÄÖµ£¨value£©¡£×¢Òâµ½ÎÒÃÇÕâÀïËù˵µÄ"´ú±í"£¬¶ÔÓÚÒ»¸ö¶ÔÏó£¬Èç¹ûÎÒÃÇÐèҪȡ³ö£¨fetch£©ËüµÄÖµ£¬ÄÇôÎÒÃÇÐèҪͨ¹ýÒ»¶¨µÄÀàÐÍ£¨type£©À´ÒýÓÃËü¡£Ê¹Óò»Í¬µÄÀàÐÍ£¬¶Ôͬһ¶ÔÏóÖеÄÄÚÈݵĽâÊͻᵼÖ¿ÉÄܵõ½²»Í¬µÄÖµ£¬»òÕß²úÉúijЩ䶨ÒåµÄÐÐΪ¡£
    ÔÚ½éÉÜ×óֵ֮ǰ£¬ÎÒÃÇ»¹ÐèÒªÒýÈëÒ»¸ö¸ÅÄ ±äÁ¿£¨variable£©¡£¾­³£ÓÐÈË»á°Ñ±äÁ¿Óë¶ÔÏó¶þÕß»ìÏý¡£Ê²Ã´½Ð±äÁ¿£¿Ëùν±äÁ¿ÊÇÒ»ÖÖÉùÃ÷£¬Í¨¹ýÉùÃ÷£¬ÎÒÃÇ°ÑÒ»¸öÃû×Ö£¨name£©ÓëÒ»¸ö¶ÔÏó¶ÔÓ¦ÆðÀ´£¬µ±ÎÒÃÇʹÓøÃÃû×Öʱ£¬¾Í±íʾÁËÎÒÃǶԸöÔÏó½øÐÐijÖÖ²Ù×÷¡£µ«ÊDz¢²»ÊÇÿ¸ö¶ÔÏó¶¼ÓÐÃû×Ö£¬Ò²²¢²»Òâζ×ÅÓжÔÓ¦µÄ±äÁ¿¡£±ÈÈçÁÙʱ¶ÔÏó£¨temporary object£©¾ÍûÓÐÒ»¸öÃû×ÖÓëÖ®¹ØÁª£¨²»ÒªÎó³ÆΪÁÙʱ±äÁ¿£¬ÕâÊDz»ÕýÈ·µÄ˵·¨£©¡£
   1 CÖеÄ×óÖµ
    1.1°´ÕÕCµÄ¶¨Ò壬×óÖµÊÇÒ»¸öÒýÓõ½¶ÔÏóµÄ±í´ïʽ£¬Í¨¹ý×óÖµÎÒÃÇ¿ÉÒÔÈ¡³ö¸Ã¶ÔÏóµÄÖµ¡£Í¨¹ý¿ÉÐ޸ĵÄ×óÖµ±í´ïʽ£¨modifiable lvalue£©ÎÒÃÇ»¹¿ÉÒÔÐ޸ĸöÔÏóµÄÖµ¡££¨ÐèҪ˵Ã÷µÄÊÇ£¬ÔÚC++ÖУ¬×óÖµ»¹¿ÉÒÔÒýÓõ½º¯Êý£¬¼´±í´ïʽfÈç¹ûÒýÓõÄÊǺ¯ÊýÀàÐÍ£¬ÄÇôÔÚCÖÐËü¼È²»ÊÇ×óÖµÒ²²»ÊÇÓÒÖµ£»¶øÔÚC++ÖÐÔòÊÇ×óÖµ£©¡£ÒòΪ×óÖµÒýÓõ½Ä³Ò»¶ÔÏó£¬Òò´ËÎÒÃÇʹÓÃ&¶Ô×óÖµ±í´ïʽ£¨Ò²Ö»ÄܶÔ×óÖµ±í´ïʽºÍº¯Êý£©È¡Ö·ÔËËãʱ£¬¿ÉÒÔ»ñµÃ¸Ã¶ÔÏóµÄµØÖ·£¨ÓÐÁ½ÖÖ×óÖµ±í´ïʽ²»ÄÜÈ¡Ö·£¬Ò»ÊǾßÓÐλÓò£¨ bit-field £©ÀàÐÍ£¬ÒòΪʵÏÖÖÐ×îСѰַµ¥Î»ÊÇ byte£»ÁíÒ»¸öÊǾßÓÐregisterÖ¸¶¨·û£¬Ê¹ÓÃregisterÐÞÊεıäÁ¿±àÒëÆ÷¿ÉÄÜ»áÓÅ»¯µ½¼Ä´æÆ÷ÖУ©¡£
Ex1.1
char a[10]; // a is an lvalue representing an array of 10 ints.
char (* p)[10]=&a; // &a is the address of the array a.
const char* p="hello world"; //"hello world" is an lvalue of type char[12]
                   &


Ïà¹ØÎĵµ£º

C/C++»ù±¾Êý¾ÝÀàÐÍ

ѧÁËCÈ»ºóC++£¬È»ºóMFC/Windows,È»ºóÊÇC#,ÆäÖÐÊý¾ÝÀàÐͺܶ࣬ÓÉ»ù±¾ÀàÐÍÑÜÉúµÄtypedefÀàÐÍÒ²N¶à¡£ÊìÖª»ù±¾Êý¾ÝÀàÐÍÊÇÎÒÃÇÕýÈ·±í´ïʵ¼ÊÎÊÌâÖи÷ÖÖÊý¾ÝµÄÇ°ÌᣬÒò´ËÎÒ·ÖÀà×ܽáÁËÒ»ÏÂC/C++/Windows /C#»ù±¾Êý¾ÝÀàÐÍ£¬ÒÔ±ãÈÕºó²éÔÄ¡£
         ANSI C/C++»ù±¾Êý¾ÝÀàÐÍ£º
Type
Size ......

C++ÓëJavaµÄÇø±ðÏê½â:

1.JavaÔÚÐéÄâ»úÉÏÔËÐР
JavaÔ´´úÂë²¢²»ÊDZ»±àÒë³ÉΪÆÕͨµÄ»úÆ÷´úÂë¡£¶øÊDZ»·­Òë³ÉΪÐéÄâ»ú¿ÉÒÔÖ´ÐеĴúÂë¡£Ò»¸öJava½âÊÍÆ÷×îÖÕÖ´ÐÐÕâЩ´úÂë¡£ÕâÆäÖÐûÓÐÁ¬½ÓµÄ¹ý³Ì£»½âÊÍÔÚÐèÒªµÄʱºò¶¯Ì¬µÄ¼ÓÔØһЩÀࣻ 
2.JavaÊÇÍêÈ«ÃæÏò¶ÔÏóµÄ 
JavaÊÇÒ»ÖÖÍêÈ«ÃæÏò¶ÔÏóµÄÓïÑÔ¡£ÕâÒâζ×ÅÄã¶ÔÈκÎÒ»¸öJava¶ÔÏóËù×öµÄ¶ ......

²»ÓÃÁÙʱ±äÁ¿½»»»Á½¸öÊýµÄÖµ(CʵÏÖ)

µ±Òª½»»»Á½¸öÊýµÄֵʱ£¬Í¨³£µÄ×ö·¨ÊǶ¨ÒåÒ»¸öÁÙʱ±äÁ¿£¬È»ºóÔÙ½øÐн»»»¡£ÄÇôÄܲ»Äܲ»ÓÃÁÙʱ±äÁ¿¶ø½»»»Á½¸öÊýµÄÖµÄØ£¿¿ÉÒԵģ¡CÓïÑÔÌṩµÄÒì»òÔËËã¾Í¿ÉÒÔʵÏÖÕâÑùµÄ²Ù×÷¡£
 
Òì»òÔËËã·û^Ò²³ÆXORÔËËã·û£¬ËüµÄ¹æÔòÊÇÈô²Î¼ÓÔËËãµÄÁ½¸ö¶þ½øλͬºÅ£¬Ôò½á¹ûΪ0£¨¼Ù£©£»ÒìºÅΪ1£¨Õ棩¡£¼´0 ^ 0 = 0, 0 ^ 1 = 1, 1 ^ 0 = 1, ......

cµ÷ÓÃapi´ò¿ªÎļþ¶Ô»°¿ò

#include <windows.h>
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd )
{
OPENFILENAME ofn;
//ÔÚÄÚ´æÖпª±ÙÒ»¿é¿Õ¼ä£¬´æ·ÅÓû§Ñ¡È¡µÄÎļþÃû
char szFile[MAX_PATH];//MAX_PATH ......

´¿CʵÏÖc++Àà

//#include "stdafx.h"
/*
ÃèÊö:´¿cÄ£ÄâÀà,´¿c±àдc++Àà,´¿cʵÏÖc++ÀàµÄ¼òµ¥·¶Àý,½á¹¹Ä£ÄâÀà,struct ±àдclass.
c±àдÀàÊÇʵÏÖ´¿c±àдcom×é¼þµÄ»ù´¡¡£
*/
#include <stdio.h>
typedef struct _Vtbl
{
    void (*AddRef)(struct CObject* obj,int);//ËùÓеĺ¯ÊýµÄµÚÒ»¸ö²ÎÊýÀàËÆclassµÄÒþÄäµÄ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ