objective-c demo
来源:互联网 发布:经纬度定位软件安卓版 编辑:程序博客网 时间:2024/05/25 12:22
//// Student.h// cmd001//// Created by wu jianhua on 16-7-27.// Copyright (c) 2016年 wujianhua. All rights reserved.//#import <Foundation/Foundation.h>@interface Student : NSObject{ int age; int no;}- (int)getAge;- (int)age;- (void)setAge:(int)newAge;-(void)setAge:(int)newAge andNo:(int)newNo;- (int)no;@end
//// Student.m// cmd001//// Created by wu jianhua on 16-7-27.// Copyright (c) 2016年 wujianhua. All rights reserved.//#import "Student.h"@implementation Student- (int)getAge{ NSLog(@"invoke getAge"); return age;}- (int)age{ NSLog(@"invoke age"); return age;}- (void)setAge:(int)newAge{ age=newAge; NSLog(@"invoke setAge"); }- (void)setAge:(int)newAge andNo:(int)newNo{ age=newAge; no=newNo; NSLog(@"invoke setAgeAndNo"); }- (int)no{ return no;}@end
//// main.m// cmd001//// Created by wu jianhua on 16-7-27.// Copyright (c) 2016年 wujianhua. All rights reserved.//#import <Foundation/Foundation.h>#import <stdio.h>#import "Student.h"/*int __jijiu(){ int i=10; int j=50; int c=i+j; printf("nine nine for mul table!!\n"); for(int m=1;m<10;m++) { for(int n=1;n<=m;n++) { printf("%dX%d=%d\t",n,m,m*n); } printf("\n"); } printf("\n"); printf("\n"); printf("\n"); printf("result=%d\n",c); NSLog(@"result=%d",c); return 0; }*///jiujiu chengfabiaoint main(int argc, const char * argv[]){ @autoreleasepool { Student *stu=[[Student alloc] init]; [stu setAge:100]; int age=[stu getAge]; NSLog(@"stu age is %d",age); age=[stu age]; NSLog(@"stu age is %d",age); [stu setAge:99 andNo:1024]; NSLog(@"age is %d and no is %d",[stu age],[stu no]); [stu release]; // insert code here... //NSLog(@"Hello, World!"); } return 0;}
0 0
- Objective-C Rectangle Demo
- objective-c demo
- 【IOS学习】Objective-C 协议,以及demo
- Objective-C Swift 混合编程的demo
- Objective-C、Cocoa、Mac、IOS、Cocos2d开发资料及Demo整合
- Objective-C MapKit的使用-LBS简单的租车主界面demo
- Objective-C
- Objective-C
- Objective-C
- Objective-c
- Objective-c
- Objective-C
- Objective-C
- Objective-C
- Objective-C
- Objective-C
- objective-c
- Objective-c
- unity美术要求
- SGU 495 Kids and Prizes(期望DP || 数学规律)
- 【 OpenJ_Bailian 4118 】开餐馆
- RxJava新手入门之一 创建被观察者对象去订阅观察者调用并消费事件
- Spring框架学习之(四)--AOP
- objective-c demo
- 如何运行从网上下载的项目,如何解决identifier的问题
- 软件测试的几个性能指标
- 【论文笔记】基于2-channel network的图片相似度判别-CVPR 2015
- Guess Number Higher or Lower
- android Application Component研究之Activity(一)
- 常用CMD命令
- SSH框架流程
- jQuery 事件和动画总结