• 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: Interface declarations necessary?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interface declarations necessary?


  • Subject: Re: Interface declarations necessary?
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Sat, 14 Feb 2004 12:17:28 -0800

Hello...

I would recommend that you write the interface declaration anyway, since it would be trivial to do.

@interface myclass: rootclass
- (void)yo; /* you wouldn't even need this line if the rootclass already declared the yo method */
@end

You could just add these two/three lines for each of the two subclasses in the header file of the main class if you didn't want to make seperate header files, but it's not a whole lot of work to make a few extra header files either. If this is for some type of framework you could make the subclass headers private headers if you wanted.

The only hidden pitfall I can think of it that you wouldn't be able to make a subclass of one of those classes without writing the interface declaration at that point, but there could be others...

Louis


Are interface declarations necessary? I have a sort of class clusters situation where I have the main class and one or two subclasses that have very slight differences which are actually returned. Neither of them have extra member variables, so I would really like to just write the implementation. I tried just skipping the interface declaration and it seemed to work, all I got was a warning but it ran fine. Is there an "accepted" way to do this? Are there any hidden pitfalls in doing this?

basically i did this:

@implementaiton myclass: rootclass

- (void)yo
{
//crazy stuff
}

@end

Francisco Tolmasky
email@hidden
http://users.adelphia.net/~ftolmasky
_______________________________________________
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.
_______________________________________________
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: 
 >Interface declarations necessary? (From: Francisco Tolmasky <email@hidden>)

  • Prev by Date: Re: NSImage and flipping
  • Next by Date: Re: Problem Compiling Cocoa App
  • Previous by thread: Interface declarations necessary?
  • Next by thread: Incapsulating the Bundle resources in a ".ja" file
  • Index(es):
    • Date
    • Thread