抽象类
简单的说就是,在定义子类时,在子类中只声明那些需要具体定义的方法,这样的类就是抽象类,或者称为虚类。
#import <Foundation/Foundation.h>
@class NSString;
@interface Figure : NSObject
@property(assign) NSPoint location; //设置图形的位置
- (void)setSize:(NSSize)newsize;
- (double)area;
- (NSString *)figureName;
- (NSString *)stringOfSzie;
- (NSString *)description;
@end
抽象类的声明
#import "Figure.h"
@implementation Figure
@synthesize location;
- (void)setSize:(NSSize)newsize{}
- (double)area{return 0.0;}
- (NSString *)figureName{return nil;}
- (NSString *)stringOfSzie{return nil;}
- (NSString *)description{
NSPoint loc = self.location;
return [NSStrin