//
// 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;
}