• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
灰摩托
灰摩托
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理

2016年5月13日

随笔--2016年5月13日 星期五
摘要: 阅读全文
posted @ 2016-05-13 17:13 huimotuo 阅读(123) 评论(0) 推荐(0)
 
 

2015年4月29日

Exercise 2-1.
摘要: Exercise 2-1. Write a program that prompts the user to enter a distance in inches andthen outputs that distance in yards, feet, and inches. (For those... 阅读全文
posted @ 2015-04-29 07:31 huimotuo 阅读(170) 评论(0) 推荐(0)
 
 

2015年4月27日

类-练习-总
摘要: /* 1.设计2个类,类之间的关系自拟(比如继承、组合) 1> 车 (1)属性 * 轮子数 * 速度 (2)方法 * 属性相应的set和get方法 2> 客车 (1)属性 * 轮子数 * 速度 * 座位数 (2)方法 * 属性相应的set和get方法*/// 客车 是一种 车,因此用继承关系#... 阅读全文
posted @ 2015-04-27 12:24 huimotuo 阅读(226) 评论(0) 推荐(0)
 
类-练习
摘要: /* 1.设计2个类,类之间的关系自拟(比如继承、组合) 1> 车 (1)属性 * 轮子数 * 速度 (2)方法 * 属性相应的set和get方法 2> 客车 (1)属性 * 轮子数 * 速度 * 座位数 (2)方法 * 属性相应的set和get方法*/// 客车 是一种 车,因此用继承关系#... 阅读全文
posted @ 2015-04-27 12:21 huimotuo 阅读(150) 评论(0) 推荐(0)
 
 

2015年4月26日

面向对象三大特性-作业1-super使用方法
摘要: 1.对象方法类方法#import @interface Person : NSObject{ int _age;}- (void)test1;+ (void)test2;@end@implementation Person- (void)test1{ NSLog(@"调用了test1方法... 阅读全文
posted @ 2015-04-26 19:26 huimotuo 阅读(282) 评论(0) 推荐(0)
 
16- NSString
摘要: #import @interface Person : NSObject{ //char *_name; NSString *_name;}@endint main(){ /* // 最简单的创建字符串的方式 NSString *str = @"itcast"; ... 阅读全文
posted @ 2015-04-26 19:10 huimotuo 阅读(70) 评论(0) 推荐(0)
 
15-多态
摘要: #import /* 多态 1.没有继承就没有多态 2.代码的体现:父类类型的指针指向子类对象 3.好处:如果函数\方法参数中使用的是父类类型,可以传入父类、子类对象 4.局限性: 1> 父类类型的变量 不能 直接调用子类特有的方法。必须强转为子类类型变量后,才能直接调用子类特有的方法 */// 动... 阅读全文
posted @ 2015-04-26 18:59 huimotuo 阅读(119) 评论(0) 推荐(0)
 
14-super
摘要: /* 僵尸 跳跃僵尸、舞王僵尸、铁桶僵尸 */#import /* super的作用 1.直接调用父类中的某个方法 2.super处在对象方法中,那么就会调用父类的对象方法 super处在类方法中,那么就会调用父类的类方法 3.使用场合:子类重写父类的方法时想保留父类的一些行为 QITA ... 阅读全文
posted @ 2015-04-26 17:53 huimotuo 阅读(137) 评论(0) 推荐(0)
 
13- 继承的使用场合
摘要: /*1.继承的使用场合 1> 当两个类拥有相同属性和方法的时候,就可以将相同的东西抽取到一个父类中 2> 当A类完全拥有B类中的部分属性和方法时,可以考虑让B类继承A类 A { int _age; int _no; } B : A { int _weight; } // 继承:... 阅读全文
posted @ 2015-04-26 17:34 huimotuo 阅读(274) 评论(0) 推荐(0)
 
10-self方法使用注意
摘要: #import @interface Person : NSObject- (void)test;+ (void)test;- (void)test1;+ (void)test2;- (void)haha1;+ (void)haha2;@end@implementation Person- (voi... 阅读全文
posted @ 2015-04-26 17:30 huimotuo 阅读(282) 评论(0) 推荐(0)
 
12-继承
摘要: //11 简单不写了/*1.重写:子类重新实现父类中的某个方法,覆盖父类以前的做法2.注意1> 父类必须声明在子类的前面2> 子类不能拥有和父类相同的成员变量3> 调用某个方法时,优先去当前类中找,如果找不到,去父类中找2.坏处:耦合性太强*/#import // Person@interface ... 阅读全文
posted @ 2015-04-26 17:30 huimotuo 阅读(130) 评论(0) 推荐(0)
 
08-self细讲
摘要: #import /*self的用途:1> 谁调用了当前方法,self就代表谁* self出现在对象方法中,self就代表对象* self出现在类方法中,self就代表类2> 在对象方法利用"self->成员变量名"访问当前对象内部的成员变量 *- (void)test{ int _a... 阅读全文
posted @ 2015-04-26 17:29 huimotuo 阅读(205) 评论(0) 推荐(0)
 
09-self 例子
摘要: /*设计一个计算器类* 求和* 求平均值*/#import // 工具类:基本没有任何成员变量,里面的方法基本都是类方法@interface JiSusnQi : NSObject+ (int)sumOfNum1:(int)num1 andNum2:(int)num2;+ (int)averageO... 阅读全文
posted @ 2015-04-26 17:29 huimotuo 阅读(110) 评论(0) 推荐(0)
 
07-self
摘要: #import /*self可以在方法、set、get中使用。*/@interface Person : NSObject{ int _age;}- (void)setAge:(int)age;- (int)age;- (void)test;@end@implementation Person... 阅读全文
posted @ 2015-04-26 17:28 huimotuo 阅读(102) 评论(0) 推荐(0)
 
06-类方法的练习
摘要: /*设计一个计算器类* 求和* 求平均值*/#import // 工具类:基本没有任何成员变量,叫做工具类,而且里面的方法基本都是类方法@interface JiSusnQi : NSObject+ (int)sumOfNum1:(int)num1 andNum2:(int)num2;+ (int)... 阅读全文
posted @ 2015-04-26 17:27 huimotuo 阅读(145) 评论(0) 推荐(0)
 
05-类--+-号使用
摘要: #import /*对象方法1> 减号 - 开头2> 只能由对象来调用3> 对象方法中能访问当前对象的成员变量(实例变量)类方法1> 加号 + 开头2> 只能由类(名)来调用3> 类方法中不能访问成员变量(实例变量)类方法的好处和使用场合1> 不依赖于对象,执行效率高2> 能用类方法,尽量用类方法3... 阅读全文
posted @ 2015-04-26 17:26 huimotuo 阅读(156) 评论(0) 推荐(0)
 
03-封装练习
摘要: /*4.设计一个成绩类* C语言成绩(可读可写)* OC成绩(可读可写)* 总分(只读)* 平均分(只读)*/#import @interface Score : NSObject{ int _cScore; // C语言成绩 int _ocScore; // OC成绩 in... 阅读全文
posted @ 2015-04-26 17:25 huimotuo 阅读(123) 评论(0) 推荐(0)
 
04--0c弱语法
摘要: #import // 尽管编译器容错能力比较,但是写代码必须规范@interface Person : NSObject- (void)test;@end@implementation Person- (void)test{ NSLog(@"哈哈哈");}@end// 一旦运行过程中出错,就会... 阅读全文
posted @ 2015-04-26 17:25 huimotuo 阅读(148) 评论(0) 推荐(0)
 
02-封装的细节
摘要: #import typedef enum { SexMan, SexWoman} Sex;@interface Student : NSObject{/*成员变量的命名规范:一定要以下划线 _ 开头 作用: 1.让成员变量和get方法的名称区分开 2.可以跟局部变量区分开,一看到下... 阅读全文
posted @ 2015-04-26 17:24 huimotuo 阅读(171) 评论(0) 推荐(0)
 
01-封装
摘要: #import @interface Student : NSObject{ // 成员变量尽量不要用@public // @public int age; //@public // 只读(readonly):只允许外界访问我的no,不允许外界修改我的no ... 阅读全文
posted @ 2015-04-26 17:23 huimotuo 阅读(124) 评论(0) 推荐(0)
 
 

2015年4月25日

【程序3】
摘要: 【程序3】题目:一个整数,它加上100后是一个完全平方数,再加上168又是一个完全平方数,请问该数是多少?1.程序分析:在10万以内判断,先将该数加上100后再开方,再将该数加上268后再开方,如果开方后 的结果满足如下条件,即是结果。请看具体分析:2.程序源代码:#include "ma... 阅读全文
posted @ 2015-04-25 08:28 huimotuo 阅读(173) 评论(0) 推荐(0)
 
【程序2】
摘要: 【程序2】题目:企业发放的奖金根据利润提成。利润(I)低于或等于10万元时,奖金可提10%;利润高 于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,可可提 成7.5%;20万到40万之间时,高于20万元的部分,可提成5%;40万到60万之间时高于 40万元... 阅读全文
posted @ 2015-04-25 08:27 huimotuo 阅读(173) 评论(0) 推荐(0)
 
【程序1】
摘要: 【程序1】题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?1.程序分析:可填在百位、十位、个位的数字都是1、2、3、4。组成所有的排列后再去 掉不满足条件的排列。 2.程序源代码:#include "stdio.h"#include "conio.h"ma... 阅读全文
posted @ 2015-04-25 08:26 huimotuo 阅读(117) 评论(0) 推荐(0)
 
 

2015年3月28日

reversing the digits
摘要: reverse the digits 阅读全文
posted @ 2015-03-28 10:00 huimotuo 阅读(215) 评论(0) 推荐(0)
 
 

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3