OC3_MyRect
//
// MyRect.h
// OC3_MyRect
//
// Created by zhangxueming on 15/6/9.
// Copyright (c) 2015年 zhangxueming. All rights reserved.
// #import <Foundation/Foundation.h> @interface MyRect : NSObject
{
int _length;
int _width;
} - (id)initWithLength:(int)length andWidth:(int)width; - (int)length; - (int)width; - (void)setLength:(int)length andWidth:(int)width; - (int)area; - (void)printArea; @end
//
// MyRect.m
// OC3_MyRect
//
// Created by zhangxueming on 15/6/9.
// Copyright (c) 2015年 zhangxueming. All rights reserved.
// #import "MyRect.h" @implementation MyRect - (id)initWithLength:(int)length andWidth:(int)width
{
self = [super init] ;
if (self) {
_length = length;
_width = width;
}
return self;
} - (int)length
{
return _length;
} - (int)width
{
return _width;
} - (void)setLength:(int)length andWidth:(int)width
{
_length = length;
_width = width;
} - (int)area;
{
return [self length] * [self width];
} - (void)printArea
{
NSLog(@"area = %i", [self area]);
} @end
//
// main.m
// OC3_MyRect
//
// Created by zhangxueming on 15/6/9.
// Copyright (c) 2015年 zhangxueming. All rights reserved.
// #import <Foundation/Foundation.h>
#import "MyRect.h" int main(int argc, const char * argv[]) {
@autoreleasepool {
MyRect *rect = [[MyRect alloc] init];
[rect setLength: andWidth:];
[rect printArea];
}
return ;
}
OC3_MyRect的更多相关文章
随机推荐
- Handlebar
			1.Handlebar中文网: http://www.ghostchina.com/introducing-the-handlebars-js-templating-engine/ 2.http:// ... 
- C# 通用数据访问类(SqlHelper)
			[转]C# 通用数据访问类(SqlHelper) 注:本文转自http://www.tzwhx.com/newOperate/html/3/31/312/13080.htmlVisual C# 动态操 ... 
- idea生成JAVADOC 报java.lang.IllegalArgumentException解决方案[终极]
			idea生成javadoc文档,总是会报 java.lang.IllegalArgumentException at sun.net.www.ParseUtil.decode(ParseUt ... 
- Using breakpad in cocos2d-x 3.2,dump信息收集
			作者:HU 转载请注明,原文链接:http://www.cnblogs.com/xioapingguo/p/4037268.html 一.基本步骤 1.生成转换工具 2.把breakpad加入到项目 ... 
- 时间紧迫,写一些 NavigationController 一次性返回2级界面甚至更多级的界面
			在NavigationController中,调用pushViewController可以将界面推到指定的界面,调用popToViewController可以返回上层界面,可是它的实现原理是什么? 好 ... 
- Android端如何获取手机当前的网络状态,比如wifi还是3G, 还是2G, 电信还是联通,还是移动
			不多说了,直接看代码, NB人会懂的! package com.example.vdisktest; import android.app.Activity; import android.conte ... 
- pomelo 服务器开发常用术语
			gate服务器 一个应用的gate服务器,一般不参与rpc调用,也就是说其配置项里可以没有port字段,仅仅有clientPort字段,它的作用是做前端的负载均衡.客户端往往首先向gate服务器发出请 ... 
- android121 zhihuibeijing  SlidingMenu(侧边栏效果,使用开源库)
			## Splash ## - 旋转 RotateAnimation - 缩放 ScaleAnimation - 渐变 AlphaAnimation 工程可以作为一个库被其他工程当成一个Library使 ... 
- php开启新的进程或者线程
			开启线程: $php_cli_path = '/usr/bin/php';$dir_path = dirname(__FILE__)."/".'CheckTaskState.she ... 
- python--字符工厂函数dict()
			字符工厂函数str() class str(object): """ str(object='') -> str str(bytes_or_buffer[, enc ... 
