#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; |
|