• 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: Subclassing NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing NSString


  • Subject: Re: Subclassing NSString
  • From: Ali Ozer <email@hidden>
  • Date: Sat, 16 Jun 2001 12:33:49 -0700

> And I don't think your objects is really a string when it has a
> ProcessSerialNumber. I think you should use the following:
>
> //ModelApp.h
> @interface ModelAppObject : NSString
> {
> ProcessSerialNumber psn;
> NSString *string;
> }

Yes, this is a better approach; but I think you meant

@interface ModelAppObject : NSObject

that is, subclass of NSObject, not NSString.

In any case, yes, you do not want to subclass NSString to make it into
something else; you typically subclass NSString to provide alternate
implementations. That is because NSString is simply a unichar array +
length; add other attributes and it's no longer an NSString. That is why
NSAttributedString is not a subclass of NSString, for instance.

Ali


References: 
 >Re: Subclassing NSString (From: Andreas Monitzer <email@hidden>)

  • Prev by Date: Re: WWDC Dev Tools / Software update
  • Next by Date: Re: Trouble with NSTimer
  • Previous by thread: Re: Subclassing NSString
  • Next by thread: Trouble with NSTimer
  • Index(es):
    • Date
    • Thread