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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:22:54+00:00 2026-05-20T12:22:54+00:00

Lets say that i have a class with some instance variables and i want

  • 0

Lets say that i have a class with some instance variables and i want to expose those i-vars for “Read Only” use through Dot Notation Property, but in the same time to be able to use the Property Mutator inside my class, also with Dot Notation.

The problem is, that is i’m declaring in my .h file like that:

@property (readonly) ....

Then even if i’m writing the mutator myself (-(void) setMyIvar:) i cant use it with the dot notation because the compiler is complaining (rightfully) that the property is readonly.

I tried to re-declare the property in my .m file (inside an interface extension) like that:

@inteface MyClass()
@property (retain) myIvar;
@end

But the compiler did not accept this double-declaration.

Is there any way i can do that?

  • 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-20T12:22:54+00:00Added an answer on May 20, 2026 at 12:22 pm

    You can do this, but you’ll have to do it like this:

    @property (retain,readonly) ....
    

    In your implementation:

    @inteface MyClass()
    @property (retain,readwrite) myIvar;
    @end
    

    In other words, the declaration should be the same, apart from the accessibility.

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

Sidebar

Related Questions

I want to make a PHP class, lets say Myclass.php. Now inside that class
Let's say that I have a class Foo: public class Foo { public static
Let's say I have a class that has a member called data which is
Let's say I have one class Foo that has a bunch of logic in
Let's say I have a class that implements the IDisposable interface. Something like this:
Let's say I have a class called Store that has many Employees. My RESTful
Let's say we have defined a CSS class that is being applied to various
Let's say I have a table that represents a super class, students . And
Let's say I have data structures that're something like this: Public Class AttendenceRecord Public
Lets say that you have websites www.xyz.com and www.abc.com. Lets say that a user

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.