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

Objective C 2.0 ÊôÐÔ(Property)

Ô­ÌûÒ»£ºhttp://blog.csdn.net/dotphoenix/archive/2009/05/20/4203075.aspx
Ô­Ìù¶þ£ºhttp://www.cocoachina.com/bbs/read.php?tid-8008.html
@property (²ÎÊý) ÀàÐÍ Ãû×Ö;
ÕâÀïµÄ²ÎÊýÖ÷Òª·ÖΪÈýÀࣺ¶ÁдÊôÐÔ£¨readwrite/readonly£©£¬setterÓïÒ⣨assign/retain/copy£©ÒÔ¼°atomicity£¨nonatomic£©¡£
assign/retain/copy¾ö¶¨ÁËÒÔºÎÖÖ·½Ê½¶ÔÊý¾Ý³ÉÔ±¸³ÓèÐÂÖµ¡£ÎÒÃÇÔÚÉùÃ÷summary properyʱʹÓÃÁËreadonly£¬ËµÃ÷¿Í»§¶ËÖ»ÄܶԸÃproperty½øÐжÁÈ¡¡£atomicityµÄĬÈÏÖµÊÇatomic£¬¶ÁÈ¡º¯ÊýΪԭ×Ó²Ù×÷¡£
ÔÚobjective c 2.0Ï£¬ÓÉÓÚÎÒÃÇÉùÃ÷ÁËproperty£¬implementationÎļþ¿ÉÒÔ¸ü¸ÄÈçÏ£º
¿ÉÒÔ¿´µ½Êý¾Ý³ÉÔ±titleºÍnumofpagesµÄ¶Áдº¯ÊýÒѾ­²»¸´´æÔÚ£¬È¡¶ø´úÖ®µÄÊÇÁ½ÐÐ@synthesize£¬
¼ûÏÂÁÐʾÀý´úÂ룺
 
//test.h
@interface MyTest : NSObject {
int myArray[5];
}
@end
 
Èç¹û²ÉÓÃ
@property int myArray[5];
¿Ï¶¨»á³ö´í¡£
ÒòΪ@propertyµÄÉùÃ÷ָʾ±àÒëÆ÷ĬÈϵظømyArrayÌí¼ÓÁËmyArrayÒÔ¼°setMyArrayµÄÕâÑùÒ»¶ÔgetterºÍsetter·½·¨¡£ÓÉÓÚobjective-CÖз½·¨µÄ·µ»ØÀàÐͲ»ÄÜÊÇÊý×飬ËùÒÔÉÏÊöÉùÃ÷propertyµÄ·½Ê½ÊÇͨ²»¹ý±àÒëµÄ¡£
ÕýÈ·µÄ·½Ê½ÊÇ£º
 
//test.h
@interface MyTest : NSObject {
int myArray[5];
}
- (void)outPutValues;
@property int* myArray;
@end
 
¼´£¬Ê¹ÓÃÖ¸ÕëÀ´±íʾ·µ»ØÀàÐͲ¢×÷Ϊ²ÎÊýÉèÖÃÀàÐÍ¡£
²»¹ýÕâÑùÒ»À´¾ÍÎÞ·¨ÔÚ.mÎļþµÄʵÏÖÖÐʹÓÃ@synthesize£¬¶øÊÇÐèÒªÏÔʽµØÊµÏÖÕâ¶Ô·½·¨£º
 
#import <Foundation/Foundation.h>
#import "test.h"
#include <stdio.h>
 
@implementation MyTest
 
- (int*)myArray
{
return myArray;
}
 
- (void)setMyArray:(int*)anArray
{
if(anArray != NULL)
{
for(int i=0; i<5; i++)
myArray[i] = anArray[i];
}
}
ÕâÑùÒ»À´¶ÔÓÚÊý×éÐͱäÁ¿³ÉÔ±¾ÍÎÞ·¨Ê¹Óõ㣨.£©²Ù×÷·ûÀ´³éÏóµô¶ÔsetterºÍgetterµÄµ÷Óã¨Ê¹Óõã²Ù×÷·û·ÃÎʶÔÏóµÄ³ÉÔ±Êý¾Ý·Ç³£·½±ã£¬
¸ù¾ÝË÷Òª·ÃÎʵÄÊý¾Ý³ÉÔ±´¦ÓÚ×óÖµ»¹ÊÇÓÒÖµ¶øÓɱàÒëÆ÷×Ô¶¯Åж¨µ÷ÓÃsetter»¹ÊÇgetter£©¡£
 


Ïà¹ØÎĵµ£º

ÔÚ51ϵÁе¥Æ¬»úÉÏÒÆÖ²uCOS II c´¨¿Æ´´ÐÂ

ÄÚÈÝÕªÒª£º±¾ÎÄÏêϸϵͳµØ½éÉÜÁËuC/OS-IIÔÚ51µ¥Æ¬»úÉϵÄÒÆÖ²¡¢ÖØÈëʵÏÖ·½·¨¡¢Ó²¼þ·ÂÕæ¡¢¹Ì»¯¡¢ÈË»ú½çÃæµÈ¹Ø¼üÄÚÈÝ¡£
¹Ø¼ü´Ê£ºÇ¶Èëʽʵʱ¶àÈÎÎñ²Ù×÷ϵͳ¡¢uC/OS-II¡¢C51
ÒýÑÔ£º
   Ëæ×Ÿ÷ÖÖÓ¦Óõç×ÓϵͳµÄ¸´ÔÓ»¯ºÍϵͳʵʱÐÔÐèÇóµÄÌá¸ß£¬²¢°éËæÓ¦ÓÃÈí¼þ³¯×Åϵͳ»¯·½Ïò·¢Õ¹µÄ¼ÓËÙ£¬ÔÚ16λ/32λµ¥Æ¬»úÖÐ¹ã·ºÊ¹Ó ......

CÓëC++Îļþ»¥Ïàµ÷ÓÃ

ʱ³£ÔÚcppµÄ´úÂëÖ®Öп´µ½ÕâÑùµÄ´úÂë:
#ifdef __cplusplus 
extern "C" { 
#endif
//Ò»¶Î´úÂë
#ifdef __cplusplus 

#endif 
    ÕâÑùµÄ´úÂëµ½µ×ÊÇʲôÒâË¼ÄØ£¿Ê×ÏÈ£¬__cplusplusÊÇcppÖеÄ×Ô¶¨Òåºê£¬ÄÇô¶¨ÒåÁËÕâ¸öºêµÄ»°±íʾÕâÊÇÒ»¶ÎcppµÄ´úÂ룬Ҳ¾ÍÊÇ˵£¬ÉÏÃæµÄ´úÂëµÄº ......

GNU/Linuxƽ̨µÄC³ÌÐò¿ª·¢¼°³ÌÐòÔËÐл·¾³

±¾ÎĽéÉÜÔÚGNU/Linux»·¾³ÏÂÒ»¸öC³ÌÐòÓÉÔ´´úÂëµ½³ÌÐò£¬µ½¼ÓÔØÔËÐУ¬×îºóÖÕÖ¹µÄ¹ý³Ì¡£Í¬Ê±ÒԴ˹ý³ÌÎªÔØÌ壬½éÉÜGNU/Linuxƽ̨ÏÂÈí¼þ¿ª·¢¹¤¾ßµÄʹÓá£
 
±¾ÎÄÒÔÎÒÃÇ×î³£¼ûµÄhello, world!ΪÀý£º
 
#include <stdio.h>
main ()
{
      printf(“hello, world!\n” ......

C¿âº¯Êý(×Ö·û´®º¯Êý)


C¿âº¯Êý
×Ö·û´®º¯Êý
 
 
 
º¯ÊýÃû
º¯ÊýÔ­ÐÍ
¹¦ÄÜ
·µ»ØÖµ
°üº¬Í·Îļþ
strcat
char *strcat(char *st1, char *str2)
°Ñstr2Á¬½Óµ½str1ºóÃæ
str1
string.h
strchr
char *strchr(char *str, int ch)
ÕÒ³östrÖ¸ÏòµÄ×Ö·û´®ÖеÚÒ»´Î³öÏÖ×Ö·û´®chµÄλÖÃ
Ö¸Ïò¸ÃλÖõÄÖ¸Õ룬δÕÒµ½Ôò·µ»Ø¿ÕÖ¸Õë
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ