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

C++µÄÀàÓëCÀïÃæµÄstructµÄÇø±ð


C++µÄÀàÓëCÀïÃæµÄstructµÄÇø±ð
2009-10-11 15:32
¹ØÓÚʹÓôóÀ¨ºÅ³õʼ»¯
classºÍstructÈç¹û¶¨ÒåÁ˹¹Ô캯ÊýµÄ»°£¬¶¼²»ÄÜÓôóÀ¨ºÅ½øÐгõʼ»¯
Èç¹ûûÓж¨Òå¹¹Ô캯Êý£¬struct¿ÉÒÔÓôóÀ¨ºÅ³õʼ»¯¡£
Èç¹ûûÓж¨Òå¹¹Ô캯Êý£¬ÇÒËùÓгÉÔ±±äÁ¿È«ÊÇpublicµÄ»°£¬¿ÉÒÔÓôóÀ¨ºÅ³õʼ»¯¡£
¹ØÓÚĬÈÏ·ÃÎÊȨÏÞ
classÖÐĬÈϵijÉÔ±·ÃÎÊȨÏÞÊÇprivateµÄ£¬¶østructÖÐÔòÊÇpublicµÄ¡£
¹ØÓڼ̳з½Ê½
class¼Ì³ÐĬÈÏÊÇprivate¼Ì³Ð£¬¶østruct¼Ì³ÐĬÈÏÊÇpublic¼Ì³Ð¡£
ΪʲôÔÚC++ÖдæÔÚstruct£¿ºÜ¶àÈ˶¼»áÏëµ½ÕâÊÇΪÁËÈÃC++ºÍC¼æÈÝ£¬ÄÇôÎÊÌâ¾ÍÊÇÈçºÎʹÓÃC++ÖеÄstructºÍC¼æÈÝÆðÀ´¡£
°ÑC++Òª½»»»µ½C³ÌÐòµÄÊý¾ÝÔÚC++³ÌÐòÖÐÉùÃ÷³ÉÒ»¸östruct£¬È»ºó¸ù¾ÝC++ÖгÌÐòµÄÓïÒâÑ¡Ôñ¼Ì³Ð»òÕß¾ÛºÏÕâ¸östruct£¬È»ºóÔÚʹÓõÄʱºò¾Í¿ÉÒÔ°ÑÕâ¸östruct·â×°ÆðÀ´´«µÝµ½CÖлòÕß´ÓCÖд«µÝµ½C++¡££¨×¢£ºÔÚÉîÈë̽Ë÷C++¶ÔÏóÄ£ÐÍÖн¨ÒéʹÓþۺϣ¬¶ø²»ÊǼ̳У¬Ô­ÒòÊÇΪÁ˺ÍCÓïÑԵĿռä·Ö²¼¼æÈÝ£¬ÒòΪÔÚC++ÒýÈëÐ麯Êý£¬Ðé¼Ì³Ðµ¼ÖÂÁËÅÉÉúÀàµÄ¿Õ¼ä°üÀ¨structµÄ¿Õ¼äºÍvptr¡¢vbtl£¬¶øÇÒvptr¡¢vbtl´æ·ÅÔÚÄÄÀïÓɱàÒëÆ÷×Ô¼º¾ö¶¨£¬C++±ê×¼ÖÐûÓж¨Ò壩¡£
¸ø³öÒ»¸ö´ÓC++µ½CÓïÑÔµÄÒ»¸ö¼òµ¥µÄÀý×Ó£º
//C++Í·ÎļþmoduleA.h
#ifndef MODULE_A_H
#define MODULE_A_H
struct person
{
       int age;
       char name[20];
};
class male
{
      private:
              int wife;
              struct person per;
      public:
             int getAge()
             {
                return per.age;
              }
};
extern "C" void print(person );
#endif
//C++µÄʵÏÖÎļþ
#include "moduleA.h"
#include <stdio.h>
void print(person per)
{
        printf("age :%d, \n",per.age);


Ïà¹ØÎĵµ£º

realview MDK C/C++ »ìºÏ±à³ÌÎÊÌâ

ǰ¼¸Ìì¸ãÒ»¸öÏîÄ¿Éæ¼°µ½C/C++»ìºÏ±à³Ì£¬ÔÚKeilϱàÒëʱÌáʾ£º
error: #800:this declaration may not have extern "C" linkage
error: At end of source : #67:expected a "}"
µ±Ê±Á¢ÂíÏëµ½ÊÇCºÍC++±à³ÌʱÐèÒªextern "C"£¬ÂíÉÏÊÔÁËÊÔ£¬È»ºóÐû¸æÊ§°Ü¡£
ÒòΪ˫»÷ºóÌáʾ³ö´íµÄµØ·½ÊÇtemplate<clase T>,ÒÔΪÊÇkeil²»Ö ......

CÓïÑÔÁ¬½ÓMySQLÖÐÎÄÎÊÌâ

ÔÚѧϰ£¼Linux³ÌÐòÉè¼Æ£¾µÚ8ÕÂMySQLÊý¾Ý¿â8.3½Ú£º
ʹÓÃCÓïÑÔ·ÃÎÊMySQL·ÃÎÊÊý¾Ý¿âʱ³¢ÊÔ°ÑSQLÊý¾Ý»»³ÉÁËÖÐÎÄ£¬µ«ÊÇÔÚÔËÐÐʾÀý³ÌÐòʱÖÕ¶ËÊä³öÈ´ÂÒÂ룬MySQL C ÓïÑÔÁ¬½ÓĬÈÏ×Ö·û¼¯ÊÇlatin1
²éÁËÏÂAPIÕÒµ½ÈçϺ¯Êý¿É½â¾öÖÐÎÄÂÒÂëÎÊÌâ¡£
int
mysql_set_character_set(
MYSQL *
mysql,
char
*
csname)
ÃèÊö
¸Ãº¯ÊýÓ ......

¹ØÓÚ¡¶0 bug C/C++ÉÌÓù¤³ÌÖ®µÀ¡·µÄÒ»µã˵Ã÷

ÎÒÕâÁ½ÌìÔÚCSDNÂÛ̳¿ªÁËÒ»¸öÉ¢·ÖÌù£¬ÏëÐû´«Ò»ÏÂÎÒµÄÊé¡£´ó¶àÊýÅóÓÑ»¹ÊǺÜÓѺõ쬶ÔÎÒµÄÖ§³ÖºÍ¹ÄÀøºÜ¶à£¬ÎÒÒ²ºÜ¸Ð¼¤¡£
ÍøÖ·ÔÚÕâÀhttp://topic.csdn.net/u/20091216/22/5a6594be-21e6-459e-ab41-57755273f465.html
µ±È»£¬Ò²ÓÐÅóÓÑÈÏΪФijÈË´µÅ££¬Ëµ0bug²»¿ÉÄÜ£¬²¢ÇÒÒþÒþÓÐPKµÄÒâ˼£¬ÎÒÄØÃ»°ì·¨£¬Ð´Á˸ö˵Ã÷¡£
ÕâÀïÏëÁ ......

C/S ÓëB/S¼Ü¹¹Çø±ðÏê½â£¨×ª£©

Ò»¡¢Ê²Ã´ÊÇC/SºÍB/S
ÒªÏë¶Ô“C/S”ºÍ“B/S”¼¼Êõ·¢Õ¹±ä»¯ÓÐËùÁ˽⣬Ê×ÏȱØÐë¸ãÇå³þÈý¸öÎÊÌâ¡£
µÚÒ»¡¢Ê²Ã´ÊÇC/S½á¹¹¡£
C/S £¨Client/Server£©½á¹¹£¬¼´´ó¼ÒÊìÖªµÄ¿Í»§»úºÍ·þÎñÆ÷½á¹¹¡£ËüÊÇÈí¼þϵͳÌåϵ½á¹¹£¬Í¨¹ýËü¿ÉÒÔ³ä·ÖÀûÓÃÁ½¶ËÓ²¼þ»·¾³µÄÓÅÊÆ£¬½«ÈÎÎñºÏÀí·ÖÅäµ½Client¶ËºÍServer¶ËÀ´Ê ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ