12、属性声明和实现的完整例子

声明:XYZPersion.h文件

1 @interface XYZPerson : NSObject
2 - (void)sayHello;
3 @end

实现:XYZPersion.m文件

1 #import "XYZPerson.h"
2 
3 @implementation XYZPerson
4 //用implementation类的实现
5 -(void)sayHello{
6   NSLog(@"Hello, World!");
//@表示是一个OC类型的字符串
7 } 8 @end

 

posted @ 2016-10-11 21:46  turbomit  阅读(97)  评论(0)    收藏  举报