当前位置: 代码迷 >> 综合 >> day01-类的练习
  详细解决方案

day01-类的练习

热度:61   发布时间:2024-02-23 17:13:25.0

//
//  main.m
//  Day01_类的练习_Student
//
//  Created by imac on 2020/9/7.
//  Copyright ? 2020 imac. All rights reserved.
//

#import <Foundation/Foundation.h>
@interface Student : NSObject
{
 @public
    NSString *_name;
    int _age;
    int _sex;
    
}
@end

@implementation Student

 

@end

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        // insert code here...
        NSLog(@"Hello, World!");
        
        Student * s1 =[Student new ];
        s1->_name=@"jack";
        s1->_age=12;
        s1->_sex=1;
        
        NSLog(@"学生名字叫%@,年龄是%d,年纪是%d",s1->_name,s1->_age,s1->_sex);
        
        
    }
    return 0;
}