• 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: Function overloading for ObjC classes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function overloading for ObjC classes


  • Subject: Re: Function overloading for ObjC classes
  • From: Ondra Cada <email@hidden>
  • Date: Sun, 22 Feb 2004 11:44:52 +0100

On Sunday, Feb 22, 2004, at 08:00 Europe/Prague, Jens Bauer wrote:

B: Make one function, that checks if it's a NSData * or a NSMutableData class.

C: Make one function that does not check anything, but uses a resonable common interface. Implement this interface in each class a different way using a category. That is, so far as I know, the cleanest and most object oriented way to do such things.

Whilst argument type-based overloading like C++ does is just plain wrong in most situations--consider

NSData *d=[NSMutableData dataWith...];
yourFunction(d); // this is definitely not what you wanted!

the runtime checks like isKindOfClass are no winner too. Also beware the immutable and mutable class clusters are often indistinguishible due to their CoreFoundation entrails!
---
Ondra Hada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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: Function overloading for ObjC classes (From: Jens Bauer <email@hidden>)

  • Prev by Date: Re: Versioning
  • Next by Date: Re: Function overloading for ObjC classes
  • Previous by thread: Re: Function overloading for ObjC classes
  • Next by thread: Re: Function overloading for ObjC classes
  • Index(es):
    • Date
    • Thread