@implementation B
- (void)handleTask {
  if(condition) {
    [super handleTask];
    return;
  }

  // B implementation

  return;
}
@end

On Sat, Sep 5, 2009 at 6:25 AM, Alex Reynolds<alexpreyno...@gmail.com> 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?
>
> Apologies in advance, if this is a dumb question. Thanks for your advice.
>
> -Alex
> _______________________________________________
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/bgulanowski%40gmail.com
>
> This email sent to bgulanow...@gmail.com
>



-- 
Brent Gulanowski
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to