Re: subclassing with conditional method overriding
Re: subclassing with conditional method overriding
- Subject: Re: subclassing with conditional method overriding
- From: "email@hidden" <email@hidden>
- Date: Sat, 5 Sep 2009 11:33:00 +0100
On 5 Sep 2009, at 11:25, Alex Reynolds wrote:
Let's say I have a class interface and implementation, as follows:
---
@interface A : NSObject {
...
}
- (void) handleTask;
@end
@implementation A
...
- (void) handleTask {
// do stuff specific to A object type...
}
---
Let's say I then subclass A and override -handleTask:
---
@interface B : A {
...
}
- (void) handleTask;
@end
@implementation B
...
- (void) handleTask {
// do stuff specific to B object type...
}
---
If I instantiate a variable of type B, is there a way to
conditionally use the -handleTask method from either class A or B?
For example, by casting to (A *) when calling -handleTask?
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocDefiningClasses.html#/
/apple_ref/doc/uid/TP30001163-CH12-BAJHDGAC
Apologies in advance, if this is a dumb question. Thanks for your
advice.
-Alex
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Jonathan Mitchell
Developer
http://www.mugginsoft.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden