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

Re: overloading operators


  • Subject: Re: overloading operators
  • From: Wade Tregaskis <email@hidden>
  • Date: Thu, 31 Oct 2002 18:05:31 +1100

Am I right in thinking that you can't overload operators in your custom classes in objective-C? If I'm wrong, could someone give me a short code example?

You're right. Operator overloading isn't something you can do in Objective-C, because operators aren't implemented as message sends.

That's the functional problem. The ideological one is that operators shouldn't be over-extended to places where they really don't belong, as can sometimes happen with over-zealous C++ coders. ObjC has no fears of being verbose, so - for instance - the choice of using a clearly named method "append" vs the operator += is considered a no brainer.

Wade Tregaskis
_______________________________________________
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.

References: 
 >Re: overloading operators (From: Chris Hanson <email@hidden>)

  • Prev by Date: Code reuse problems
  • Next by Date: Re: Better random screensaver
  • Previous by thread: Re: overloading operators
  • Next by thread: Problems with NSLayout addTextContainer
  • Index(es):
    • Date
    • Thread