• 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:53:50 +0100

On Sunday, Feb 22, 2004, at 08:06 Europe/Prague, Allan Odgaard wrote:

overloading has worked ... as long as NSMutableData and NSData are defined (i.e. using @class) but not declared (with @interface)

Uh-oh. There are three things:

(a) just informing the compiler there is a class of a given name: the @class directive. For obvious reasons, you are free to repeat it as many times as you may want to. For all practical purposes, it is an equivalent of plain C forward struct definition.

(b) the class declaration, the @interface. That cannot be repeated (but there is no deep reason for that). For all practical purposes, it is an equivalent of plain C function header.

(c) the class definition, the @implementation. That cannot be repeated, since class names are global, and they would clash. For all practical purposes, it is an equivalent of a C function (non-static).

None of the three has anything to do with overloading.

That's The Good Thing, incidentally, for overloading is bad (since it is based on the compile-time type information, and thus could and would bring ugly inconsistencies at runtime, not speaking of the fact it's unclean--creating one common class/function/method which works as well with all objects for its argument is the way to go). In C++ or Java the overloading is just a poor man's replacement for categories (and in C++ also lack of instanceof, although that is to be used only in emergencies ;)
---
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.
  • Follow-Ups:
    • Re: Function overloading for ObjC classes
      • From: Allan Odgaard <email@hidden>
References: 
 >Re: Function overloading for ObjC classes (From: Allan Odgaard <email@hidden>)

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