A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© gd32376300 中级黑马   /  2015-12-8 11:38  /  804 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

#import <Foundation/Foundation.h>
#import "Person.h"
#import "Car.h"
#import "Phone.h"
#import "Production.h"

int main(int argc,const char * argv[])
{
//    Person *person = [[Person alloc] init];
//    person -> _name = @"zhangsan";
//    person -> _sex = @"m";
//    person -> _age = 18;
//   
//    NSLog(@"name = %@,sex = %@,age = %i",person->_name,person->_sex,person->_age);
//   
//    // [person saiHey];
//    // [person eat];
//   
//    Car *car = [[Car alloc] init];
//    car -> _brand = @"dazhong";
//    car -> _price = 1234;
//    car -> _color = @"white";
//    [car sit];
//    [car start];
//
//    Phone *phone = [[Phone alloc] init];
//    [phone call];
//    Student *student = [[Student alloc] init];
//    [student speak];
//   
//
//   
//   
//        Production *introduce =[[Production alloc] init ];
//        introduce ->_name= @"zhangxiaolei";
//        introduce ->_address= @"henan";
//        introduce ->_height = 1.75 ;
//        introduce ->_age    = 24 ;
//        
//        NSLog(@"%@ %@ %.2f %d\n",introduce->_name,introduce->_address,introduce->_height,introduce->_age);

//
//  Phone.h
//  Lesson_11
//
//  Created by lanou3g on 15-3-26.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface Phone : NSObject
{
    @public
    double _price;
    NSString *_date;//存放在堆中,所以必须需要指针指向
   
}
- (void)call;
@end


@interface Student : NSObject
{
@public
    int  _age;
    NSString *_name;//存放在堆中,所以必须需要指针指向
   
}
- (void)speak;
- (id)init;
@end

//
//  Phone.m
//  Lesson_11
//
//  Created by lanou3g on 15-3-26.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "Phone.h"

@implementation Phone
- (void)call
{
    NSLog(@"call people");
}
@end

@implementation Student

- (void)speak
{
    NSLog(@"ggggg");
}
- (id)init
{
    _age = 10;
    return self;
}     
@end

//
//  Car.h
//  Lesson_11
//
//  Created by lanou3g on 15-3-26.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface Car : NSObject
{
    @public
    float  _price;
    NSString *_brand;
    NSString *_color;
}
- (void)sit;
- (void)start;

@end

//
//  Car.m
//  Lesson_11
//
//  Created by lanou3g on 15-3-26.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "Car.h"

@implementation Car
- (void)sit
{
    NSLog(@"坐下去");
}
- (void)start
{
    NSLog(@"动起来");
}
@end

//
//  Person.h
//  Lesson_11
//
//  Created by lanou3g on 15-3-26.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface Person : NSObject
{
@public
    NSString *_name;
    NSString *_sex;
    int _age;
        
}

- (void)saiHey;
- (void)eat;

@end


//
//  Production.h
//  Lesson_11
//
//  Created by lanou3g on 15-3-26.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface Production : NSObject
{
   
@public
    NSString *_name ;
    NSString *_address ;
    float    _height ;
    int      _age ;
}

- (void)myStudy ;
- (void)myHobby ;
- (void)myLove ;

@end



//
//  Production.m
//  Lesson_11
//
//  Created by lanou3g on 15-3-26.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "Production.h"

@implementation Production
- (void)myStudy
{
    NSLog(@"hao hao xue xi ");
}
- (void)myHobby
{
    NSLog(@"play basketball");
}

- (void)myLove
{
    NSLog(@"eat");
   
}

@end



//
//  Person.m
//  Lesson_11
//
//  Created by lanou3g on 15-3-26.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "Person.h"

@implementation Person
- (void)saiHey
{
    NSLog(@"Hi...");
}
- (void)eat
{
    NSLog(@"I love IOS!");
}

@end

   


   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   

        return 0;

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马