//
// main.m
// hello
// Created by 老米 on 2021/11/10.
//
#import <Foundation/Foundation.h>
//类的声明
@interface Student : NSObject
{
//类的属性声明
NSString *name;
int age;
}
//类方法声明
-(void)say;
@end
@implementation Student
//类方法实现
-(void)say
{
NSLog(@"Hello, World!");
}
@end
int main(int argc, const char * argv[]) {
@autoreleasepool {
Student *laomi=[[Student alloc]init];//类实例化对象
[laomi say];//对象调用类方法
}
return 0;
}
objective-c 之类的声明与调用(2021-11-10)
原创
©著作权归作者所有:来自51CTO博客作者一粒程序米的原创作品,请联系作者获取转载授权,否则将追究法律责任
下一篇:java计算两个日期相差的天数
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
objective-c 之类的声明与调用(2021-11-10)
//// main.m// hello// Created by 老米 on 2021/11/10.//#import <Foundation/Foundation.h>
objective-c 开发语言 macos 类方法 #import -
Objective-C语法之类和对象
1、类和方法下图中是一段的类声明的语法展示,声明了一个叫做 My对应的代码: [cpp] vie...
深入浅出Objective-C 成员变量 #import 构造函数 -
Swift与Objective-C互相调用(总结)
公司正式使用swift语言开发项目已经一年多, 现在总结一下swift和OC互相调用的经验
iOS iOS开发 swift OC flutter -
Swift与Objective-C的对比
系列(一) WWDC 2014上苹果再次惊世Swift绝对不是解...
swift 移动开发 java 编译器 构造函数 -
vue 判断是否存在sessionStorage
一个典型的stackoverflow风格的问题作为文章标题,以此避免挖空心思想名字的纠结。问题描述回到这个问题,常写模板的同学应该能心领神会需求的来源。举个简单例子,在三维数据处理中,经常会和空间点point打交道,point中会有很多种信息需要存储,比如空间坐标 x/y/z,比如法向信息 nx/ny/nz,比如颜色信息 R/G/B等,这些信息并非都是必须,在不同应用中会有不同的取舍
vue 判断文件是否存在 vue 判断是否存在 vue 判断服务器图片是否存在 vue判断图片是否存在 vue的change事件判断是否存在