Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 91881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:05:58+00:00 2026-05-10T23:05:58+00:00

I’m seeing some code I’ve inherited that looks like the following: @interface SomeClass (private)

  • 0

I’m seeing some code I’ve inherited that looks like the following:

@interface SomeClass (private) 

This is within SomeClass.m, the implementation file. There is an accompanying header file which doesn’t suggest that the class is using a category. Is (private) in this case just a poor name given to a category for SomeClass? And I’m assuming it’s perfectly legitimate to specify categories such as these in an implementation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:05:58+00:00Added an answer on May 10, 2026 at 11:05 pm

    It isn’t the name ‘private’ that makes it private; the methods are private because they are in a category declared within the implementation file.

    There are three uses of a category, each of which add methods to a class (note: methods only, not iVars)

    Extending an existing Cocoa class

    This lets you add your own methods to an existing class. For example, if you want to extend NSString to apply special capitalization, you could create a new class called, say NSString+Capitals. in the NSString+Capitals.h you would have:

    @interface NSString (Capitals)  -(NSString *)alternateCaps:(NSString *)aString;  @end 

    and in NSString+Capitals.m you would implement the method

    @implementation NSString (Capitals) -(NSString *)alternateCaps:(NSString *)aString {     // Implementation } 

    Private methods on a class

    This is the same as above, except that the extra methods are declared and defined in the implementation file (.m) Usually a way of having private methods – because they are not in the .h file (which is the one #imported by other classes) they are simply not visible. In this case, the implementation of the methods are done in their own implementation block. e.g

    // someClass.m @interface someClass (extension) -(void)extend; @end  @implementation someClass     // all the methods declared in the .h file and any superclass     // overrides in this block @end  @implementation someClass (extension) -(void)extend {     // implement private method here; } 

    Class Extension (New for 10.5 Leopard)

    A simpler way of having private methods. In this special case, the category name is empty and the private methods are implemented in the same block as all the other class methods.

    // someClass.m @interface someClass () -(void)extend; @end  @implementation someClass     // all the methods declared in the .h file and any superclass     // overrides in this block     // Implement private methods in this block as well. -(void)extend {     // implement private method here; }  @end 

    Here’s a link to the Apple docs on Categories and extensions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 101k
  • Answers 101k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer As I discovered a solution myself I will answer my… May 11, 2026 at 8:04 pm
  • Editorial Team
    Editorial Team added an answer I strongly suggest that reflection-mojo should be avoided here. A… May 11, 2026 at 8:04 pm
  • Editorial Team
    Editorial Team added an answer Yes, if you only pass the user supplied data to… May 11, 2026 at 8:04 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.