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 7716055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:32:27+00:00 2026-06-01T02:32:27+00:00

This is a related question to one I posted earlier today, I was initially

  • 0

This is a related question to one I posted earlier today, I was initially looking at how best to implement copyWithZone for an object that subclasses NSObject. I am pretty happy with what I have (see 001:) but wanted to ask about removing the setters (if it even matters, please say if its not really necessary).

It was pointed out to me that I could write:

newCrime->_title = [_title copyWithZone:zone];

I have two questions firstly, the -> is using C++ notation, is there an objective-c way of accessing a property of an object (without using a setter/dot notation)?

Finally, assign and strong how would I write those, I am pretty sure that assign would be:

newCrime->_coordinate = _coordinate;

but I am not sure about what to write for a strong pointer;

newCrime->_month =

.

@property(nonatomic, strong) NSString *month;
@property(nonatomic, strong) NSString *category;
@property(nonatomic, assign) CLLocationCoordinate2D coordinate;
@property(nonatomic, strong) NSString *locationName;
@property(nonatomic, copy) NSString *title;
@property(nonatomic, copy) NSString *subtitle;

.

// 001:
- (id)copyWithZone:(NSZone *)zone {
    Crime *newCrime = [[[self class] allocWithZone:zone] init];
    if(newCrime) {
        [newCrime setMonth:_month];
        [newCrime setCategory:_category];
        [newCrime setCoordinate:_coordinate];
        [newCrime setLocationName:_locationName];
        [newCrime setTitle:_title];
        [newCrime setSubtitle:_subtitle];
    }
    return newCrime;
}
  • 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-06-01T02:32:29+00:00Added an answer on June 1, 2026 at 2:32 am

    -> is not C++ object notation, it is C pointer notation. Please get that C++ junk out of your head 🙂

    As far as ARC is concerned, just have your variables defined in your interface as such:

    @interface myObject : NSObject
    {
        __strong strongIvar;
        __weak weakIvar;
        __unsafe_unretained assignIvar;
    }
    
    @end
    

    And ARC will do the rest when you set the object using pointer notation (->).

    For an example of pointer notation in pure C, look at the following example:

    struct myStruct {
        int intMember;
        double doubleMember;
        char *stringMember;
    };
    
    #include <stdio.h>
    #include <string.h>
    
    int main(void) 
    {
        struct myStruct *structVar = malloc(sizeof(myStruct));
        structVar->intMember = 10;
        structVar->doubleMember = M_PI * 2;
        structVar->stringMember = strdup("Hello World!");
    
        printf("%i %d %s", structVar->intMember, structVar->doubleMember, structVar->stringMember);
    
        free(structVar->stringMember);
        free(structVar);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a related question to one I posted earlier... I'm trying to sum
This question is related to another one that I posted recently: Understanding HttpServletRequest and
Another question related to this one . I have a List<SortableObjects> that is the
This question is related with one of my earlier questions.. Previous Post In there
This question is related to another one I've posted recently: Check printing with Java/JSP
James here. This question relates (sort of) to the one I posted a little
I have a question related to this one . I don't want to do
I have a question related to this one : I'm trying to attach an
This is a CSS related question, I got one good answer from my previous
This question is related to the one I asked here . I'm trying to

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.