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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:19:44+00:00 2026-05-17T01:19:44+00:00

I wrote a setter and getter method following Apple’s conventions and noticed that despite

  • 0

I wrote a setter and getter method following Apple’s conventions and noticed that despite having no variable I can still access the setter and getter using the dot syntax. Is this normal behavior? What enables this feature?

Example:

// Header definition. Keep in mind there is no class variable or @property for height.
- (void)setHeight:(float)height;
- (float)height;

// else using the dot syntax.
object.height = 10.0f;
  • 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-17T01:19:45+00:00Added an answer on May 17, 2026 at 1:19 am

    A property-access expression is equivalent to a message expression:

    [object setTexture:tex];
    

    A property declaration is equivalent to one (readonly) or two (readwrite/default) instance-method declarations. Keywords like retain tell the compiler how to implement the method if you tell it to do so (@synthesize).

    However, you can skip the property declaration and declare the methods directly, as shown in your question. You can’t synthesize their implementations, since you need a property declaration for that (otherwise, it wouldn’t know what memory-management policy to use: assign, retain, or copy), but you can always implement the methods yourself.

    Then, even though you declared and implemented the methods yourself, since property-access syntax and message syntax are equivalent to each other, you can use the methods whichever way you want: With a message expression, or with a property-access expression.

    Some would consider it bad form, though, to use property access expressions on anything but a formal @property (e.g., myString.length or myArray.count or myView.frame). It definitely is bad form to use a property-access expression to send a message that doesn’t access any kind of property; foo.retain.autorelease, for example, is bad and wrong: It reeks of trying to pretend you’re programming some other language than Objective-C.

    Incidentally, a property and a variable are unrelated. A @property will ordinarily be backed by an instance variable, but this is not required: You could store the property’s value inside another object, or convert it to and from some other format, or both. Likewise, accessing a property (which is an accessor message) and accessing an instance variable (which is just accessing a variable, nothing more) are very different.

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

Sidebar

Related Questions

I know that you use @synthesize to create setter and getter methods, which makes
I have the following structure: public class A { private javax.swing.JLabel fullName; public class
I have a class that is only ever accessed externally through static methods. Those
Suppose (for the sake of argument) that I have a view class which contains
I am working on a Spring web application and need to implement a simple
Beginner question here. In the .h file of an objective c class.. If you
For consistency, I've always applied comments (in the form of a JavaDoc) to all
My goal is to be able to write this in XAML: <Grid> <Rectangle Fill=AliceBlue
Given a type (Candidate) which has muiltiple fields one may score (here one concrete

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.