2 类与对象
来源:互联网 发布:python 量化分析 编辑:程序博客网 时间:2024/06/18 13:53
Objective-C 类型系统如下
Class结构内容
// -------------------------------------// CustomClass.h 接口文件内容@interface CustomClass: NSObject// 属性声明@property int x;// 方法声明- (void) mothed;@end// -------------------------------------// CustomClass.m 实现文件内容// 引入基础类库以及引入接口文件#import <Fondation/Foundation.h>#import "CustomClass.h"@implementation CustomClass// 接口方法的具体实现内容- (void) mothed {}@end// -------------------------------------// 其他文件// 声明并创建对象: 先请求内存分配alloc,然后初始化实例对象。CustomClass * customClass = [[CustomClass alloc] init];// 使用类属性customClass.x = 10;// 调用类方法(或者说对类发送消息)[customClass mothed];
Struct内容
// 结构定义typedef struct { int x;} CustomStruct;// 结构声明: 声明结构之后,会自动创建一个实例值。CustomStruct customStruct;// 结构内容使用customStruct.x = 10;
类与结构的差别
0 0
- 类与对象2
- 类与对象2
- 2 类与对象
- Chapter 2 类与对象
- Java_log2000_类与对象2
- 类与对象(2)
- OOP-----类与对象对象
- OOP-----类与对象对象
- 对象与元类对象
- 黑马程序员——面向对象2:类与对象
- 面向(基于)对象编程(2nd)类与对象
- 上机练习2 类与对象2
- java 类与对象 2---this关键字
- 3-2 类与对象 修旱冰场
- c++初试-类与对象(2)
- 《HotSpot实战》笔记2类与对象
- 类模板与板书对象2
- PHP学习笔记-2(类与对象)
- jxl.read.biff.BiffException: Unable to recognize OLE stream
- Freemarker笔记
- Android 设置程序先启动登录界面 再启动主界面
- 在spring的bean中注入内部类
- 关于错误的那点事——惨不忍睹的错误
- 2 类与对象
- NRF51822自学笔记(二)PWM
- android笔记
- poj3090
- 基于vitamio5.0的android播放器
- poj1995
- 设计模式(6)--Bridge 桥接模式
- ScrollView里面的EditText的点击空白处键盘消失的问题
- SSZipArchive使用详解