关于使用@property @synthesize的语法
来源:互联网 发布:七匣子充值淘宝网 编辑:程序博客网 时间:2024/05/18 01:22
#import<Foundation/Foundation.h>
#import"Ppoint.h"
@interface Shape : NSObject {
@protected
floatwidth;
floatheight;
}
@property(nonatomic)float width,height;
- (id) initWithWidth : (float) _width Height : (float) _height ;
-(float) area;
-(void) draw;
@end
--------------------------------------------
#import"Shape.h"
@implementation Shape
@synthesize width,height;
- (id) initWithWidth : (float) _width Height : (float) _height
{
if(self = [superinit])
{
width = _width;
height = _height;
}
returnself;
}
-(float) area
{
returnwidth * height;
}
-(void) draw
{
NSLog(@"这是父类的绘图方法");
}
@end//Shape.h
主要是代码中加粗和加下划线的部分,他取代了平时写的setXxx和getXxx的用法
至于@property(参数)中参数到底写什么:请参考:http://blog.rapeflower.com/property-synthesize.html
- 关于使用@property @synthesize的语法
- OC_关于property、synthesize的使用
- 关于@property&@synthesize使用详解
- @property与@synthesize的使用
- 【语法】property synthesize
- 【语法】property synthesize
- 关于@ synthesize和@property的理解
- 关于@property和@synthesize
- ios,@property与@synthesize的使用。
- synthesize与property的简单使用
- OC学习@property和@synthesize的使用
- @property 和synthesize 的使用窍门
- OC点语法、@property、@synthesize
- @property , @synthesize 使用
- 在OC中,property、synthesize和点语法的用法
- OC语言——点语法和成员变量的4种作用域及property和synthesize的使用
- 关于@property和@ synthesize梳理
- ios-关于@property和@synthesize
- android 应用如何获取系统权限 以及root系统方法
- DX锁屏后设备的恢复
- 网站压力测试工具Jmeter安装与使用
- 使用模块编译的方式编译多个.c源文件
- 亚马逊Kindle入华遇阻销量不佳 遭国内品牌"围剿"
- 关于使用@property @synthesize的语法
- Android报表库aChartEngine系列(pie chart)
- 几何方面:随机字母 【未解决 求助】
- 软件项目开发流程(转)
- Quest3d:Quest3d 常用快捷键大全
- ActionScript垃圾回收
- 中国移动电话用户数已超过11亿:3G用户2.2亿
- 四个有用的Java过滤器
- ORACEL_EBS_采购到入库所经历的表