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的更多相关文章
随机推荐
- Javascript注意事项四【提高循环性能的策略】
for(var i = item.length;i--){ process(item[i]); } 1.通过倒叙循环 2.最小化属性查询 3.尽量不要使用函数迭代(forEach)
- Oracle中的User与Schema
Oracle中有两个概念容易混淆──user和schema,本随笔记录并摘抄了一些促进理解这连个概念的理解方法,希望有助于分清这两个概念. user是控制权限的,而schema则是一个容器,非所有者如 ...
- Gitbook安装
Gitbook安装 Gitbook是从NMP安装的,命令行: $ npm install gitbook -g 安装完之后,你可以检验下是否安装成功: $ gitbook -V 0.4.2 如果你看到 ...
- Parameterized Path 的例子
Improve the planner's ability to use nested loops with inner index scans (Tom Lane) The new "pa ...
- 逻辑网络(Logical Network)
Introduction The VMM documentation indicates that “A logical network is used to organize and simplif ...
- BBSXP最新漏洞 简单注入检測 万能password
BBSXP最新漏洞 漏洞日期:2005年7月1日受害版本号:眼下全部BBSXP漏洞利用:查前台password注入语句:blog.asp?id=1%20union%20select%201,1,use ...
- Codeforces Round #320 (Div. 1) [Bayan Thanks-Round] B. "Or" Game 线段树贪心
B. "Or" Game Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/578 ...
- Windows二进制文件的Python扩展包
http://www.lfd.uci.edu/~gohlke/pythonlibs/ https://pypi.python.org/simple/
- vmware安装 ios10.8 过程
前言:由于mac笔记本太贵,并且对于用thinkpad 习惯的我,实在是不想买mac,没办法,只能在win7下面使用vmware 安装mac虚拟机了.但是ios的版本一直变,vmware也一直在升级, ...
- C#_ajax_demo
使用asp.net mvc 调用Action方法很简单. 一.无参数方法. 1.首先,引入jquery-1.5.1.min.js 脚本,根据版本不同大家自行选择. <script src=&qu ...