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

  • Home
  • SEARCH
  • 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 3280866
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:45:09+00:00 2026-05-17T19:45:09+00:00

Normally we use @interface interface_name : parent_class <delegates> { …… } @end method in

  • 0

Normally we use

@interface interface_name : parent_class <delegates>
{
......
}
@end 

method in .h file and in .m file we synthesis the properties of variables declared in .h file.

But in some code, this @interface…..@end method is kept in the .m file also. What does it mean? What is the difference between them?

Also give some words about getters and setters for the interface file that is defined in .m file…

  • 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. Editorial Team
    Editorial Team
    2026-05-17T19:45:09+00:00Added an answer on May 17, 2026 at 7:45 pm

    It’s common to put an additional @interface that defines a category containing private methods:

    Person.h:

    @interface Person
    {
        NSString *_name;
    }
    
    @property(readwrite, copy) NSString *name;
    -(NSString*)makeSmallTalkWith:(Person*)person;
    @end
    

    Person.m:

    @interface Person () //Not specifying a name for the category makes compiler checks that these methods are implemented.
    
    -(void)startThinkOfWhatToHaveForDinner;
    @end
    
    
    @implementation Person
    
    @synthesize name = _name;
    
    -(NSString*)makeSmallTalkWith:(Person*)person
    {
        [self startThinkOfWhatToHaveForDinner];
        return @"How's your day?";
    }
    
    
    -(void)startThinkOfWhatToHaveForDinner
    {
    
    }
    
    @end
    

    The ‘private category’ (the proper name for a nameless category is not ‘private category’, it’s ‘class extension’) .m prevents the compiler from warning that the methods are defined. However, because the @interface in the .m file is a category you can’t define ivars in it.

    Update 6th Aug ’12: Objective-C has evolved since this answer was written:

    • ivars can be declared in a class extension (and always could be – the answer was incorrect)
    • @synthesize is not required
    • ivars can now be declared in braces at the top of @implementation:

    that is,

    @implementation { 
         id _ivarInImplmentation;
    }
    //methods
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Viewing WCF in its use as a way to do RPC between remote PCs
I'm looking for a way to find references to a web method in other
I'm using Damian Conway's inside-out objects as described is his wonderful book Perl Best
I have a layered application with namespaces: App.Core - business layer logic services App.Data
I’ve been pondering about the C# and CIL type system today and I’ve started
I have an application with many different parts, it runs on OSGi, so there's
Ok, here goes. I've completed a Cocoa foundation-tool that calculates mean absolute deviation of
I wonder if someone can help me. I've got a console App which I
I'm trying to brush up on my design pattern skills, and I'm curious what
I am working on an app which would enable a preview function for a

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.