如果是继承某个类,就要导入类的头文件标签:end,OC,class,Book,Student,dealloc,import,book From: https://blog.51cto.com/u_15907570/5925311
@class
book.h文件:
#import <Foundation/Foundation.h>
Book : NSObject
int price;
@end
文件:
"Book.h"
Book
- (void)dealloc {
NSLog(@"Book被销毁了");
super dealloc];
}
@end
student.h文件:
#import <Foundation/Foundation.h>
Book;
@interface Student : NSObject
Book
}
Book *book;
@end
student.m文件:
#import "Student.h"
"Book.h"
Student
- (void)setBook:(Book
if (_book
_book release];
_book = [book retain];
// [book retain];
// _book = book;
}
}
- (Book
return _book;
}
- (void)dealloc {
// self.book = nil;
// [self setBook:nil];
_book release];
super dealloc];
}
@end