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

Simple question: Why does this work?


  • Subject: Simple question: Why does this work?
  • From: Sean Todd <email@hidden>
  • Date: Wed, 20 Aug 2003 16:56:34 -0500

I have found the following to compile cleanly and run without any
problems:

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:

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

What am I missing? I am compiling with gcc 3.3 (and have the flag to
treat all warnings as errors set).

Thanks,

Sean
_______________________________________________
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: Jörn Salewski <email@hidden>
    • Re: Simple question: Why does this work?
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Delegate methods[SOLVED]
  • Next by Date: Re: Applying text attributes in Cocoa
  • Previous by thread: Re: Applying text attributes in Cocoa
  • Next by thread: Re: Simple question: Why does this work?
  • Index(es):
    • Date
    • Thread