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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:03:59+00:00 2026-05-31T00:03:59+00:00

I am trying to declare a UInt32 variable that can be accessed by any

  • 0

I am trying to declare a UInt32 variable that can be accessed by any method in the class..

so its global to the classes methods but not to any other class…

I am trying to do it like this in the .h

@interface EngineRequests : NSObject {

    UInt32 dataVersion;
}

@property (copy) UInt32 dataVersion;

but thats not working.. I’m getting an error on the line @property etc.. do I even need that or is it fine to just use the UInt32 at the top.

  • 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-31T00:04:00+00:00Added an answer on May 31, 2026 at 12:04 am

    You could try

    @interface EngineRequests : NSObject {
    @protected
       UInt32 dataVersion;
    }
    
    @property (assign) UInt32 dataVersion;
    @end
    
    @implementation EngineRequests
    
    @synthesize dataVersion;
    
    // methods can access self.dataVersion
    
    @end
    

    But you don’t really need the property, unless you want to grant/control outside access. You could just declare UInt32 dataVersion in the class interface and then reference dataVersion in the implementation without self. Either way, @protected will prevent outside classes from accessing dataVersion directly.

    Have you read up on Objective-C Properties?

    Initialization

    Your EngineRequests is a subclass of NSObject. As such, you can (usually should) override NSObject‘s -(id)init method, like such:

    -(id)init {
       self = [super init];
       if (self != nil) {
          self.dataVersion = 8675309; // omit 'self.' if you have no '@property'
       }
       return self;
    }
    

    Or create your own -(id)initWithVersion:(UInt32)version;.

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

Sidebar

Related Questions

I'm trying to declare a C++ variable that takes up zero bytes. Its in
I am trying to declare a global function as a friend of a class:
I am trying to declare a variable that has a default value or if
I'm trying to declare an interface that contains a method which will return a
I'm trying to declare static variable and now my code is: class StaticClass: varA
I am trying to declare my Class as Metatype for Qt but figuring out
I am trying to declare and use a class B inside of a class
I'm trying to declare a method in main.h like this: void buildGraph(int gNum, Graph**
I was trying to declare a callback function in class and then somewhere i
I'm trying to call Window's SendMessage method in Delphi Prism, I've declared the class

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.