• 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: Simple question: Why does this work?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple question: Why does this work?


  • Subject: Re: Simple question: Why does this work?
  • From: Andreas Mayer <email@hidden>
  • Date: Thu, 21 Aug 2003 00:56:52 +0200

Am Donnerstag, 21.08.03 um 00:22 Uhr schrieb Nick Zitzmann:

NSMutableAttributedString* theString = [[[NSMutableAttributedString
alloc] init] autorelease];

[theString setString:@"Hello"];
[theString appendString:@"."];

// pass the theString off to be displayed ...

Why does this work? According to the docs, the setString: and
appendString: methods are instance methods for NSMutableString and I
should have to write:

It works because NSMutableAttributedString is a subclass of NSAttributedString. So it inherits everything from NSAttributedString...

Um. setString: and appendString: are not declared for NSAttributedString either.

That's the reason _I_ get compiler warnings when trying to compile that:

MainWindowController.m:19: warning: `NSMutableAttributedString' does not respond to `setString:'
MainWindowController.m:20: warning: `NSMutableAttributedString' does not respond to `appendString:'

And runtime errors too:

2003-08-21 00:51:09.385 StringTest[2038] *** -[NSConcreteMutableAttributedString setString:]: selector not recognized
2003-08-21 00:51:09.386 StringTest[2038] An uncaught exception was raised
2003-08-21 00:51:09.386 StringTest[2038] *** -[NSConcreteMutableAttributedString setString:]: selector not recognized
2003-08-21 00:51:09.386 StringTest[2038] *** Uncaught exception: <NSInvalidArgumentException> *** -[NSConcreteMutableAttributedString setString:]: selector not recognized

I'm using GCC 3.1 on Jaguar.

So maybe a bug in GCC 3.3 or an extension to the libraries for Panther?


bye. Andreas.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Simple question: Why does this work?
      • From: Nick Zitzmann <email@hidden>
References: 
 >Re: Simple question: Why does this work? (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: limits of objects
  • Next by Date: Re: Simple question: Why does this work?
  • Previous by thread: Re: Simple question: Why does this work?
  • Next by thread: Re: Simple question: Why does this work?
  • Index(es):
    • Date
    • Thread