• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help on subclassing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help on subclassing


  • Subject: Re: Help on subclassing
  • From: email@hidden
  • Date: Thu, 1 Dec 2005 14:39:28 -0600

I haven't tied this in xcode, so it might not work, but...

File a.h:

@interface A
@end

@protocol Foo
- (NSRect)someMethod;
@end

File a.m:

@implementation A
- (void)someOtherMethod
{
if ([self conformsToProtocol:@protocol (Foo)]) {
A<Foo> *me = (A<Foo> *)self;
NSRect rect = [me someMethod];
}
}
@end

File b.h:

@interface B <Foo>
@end

File b.m:

@implementation B
- (NSRect)someMethod
{
return ...
}
@end

I hope this isn't too far off...

Peter
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Drawing a rectangular matrix of circles - an NSMatrix?
  • Next by Date: bind image to NSButtoncells in NSMatrix
  • Previous by thread: Re: Help on subclassing
  • Next by thread: Blocking Method Return
  • Index(es):
    • Date
    • Thread