티스토리 뷰
@implementation Shape 에 구현해 놓은 메소드들을 보자.
@implementation Shape
- (void) setFillColor : (ShapeColor) c
{
fillColor = c;
}
- (void) setBounds : (ShapeRect) b
{
bounds = b;
}
- (void) draw
{
// draw 는 구현하지 않는다.
}
@end
Shape 에서 draw 를 구현하지는 않지만 하위 클래스가 상속받아 구현하도록 항상 정의한다.
하위 클래스에서 -(void) draw 를 구현하면 된다.
'나름 프로그래밍? > Objective-C' 카테고리의 다른 글
[super setFillColor: c]; (0) | 2010.01.28 |
---|---|
상속의 경우 메소드 디스패칭 (2) | 2010.01.28 |
@interface Circle : Shape (0) | 2010.01.28 |
상속 (0) | 2010.01.28 |
self -> fillColor = fillColor; (0) | 2010.01.28 |