• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting a variable from another class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting a variable from another class


  • Subject: Re: Getting a variable from another class
  • From: Ofri Wolfus <email@hidden>
  • Date: Tue, 14 Mar 2006 12:41:37 +0200

First, RAID.m is not a class. It's an implementation file :-P
You can declare public ivars using the @public keyword like this (typed in mail):


@interface MyObject {
	NSString	*name;	//This variable is protected.

@public
NSString *publicName; //This variable is public, and can be accessed directly by anyone
}
@end


You can also use the @defs() directive in order to access private/ protected ivars but it is not recommended in most cases.

Hope this helps,
- Ofri

On 14/03/2006, at 12:05, Matthew Egan wrote:

This is a Cocoa 101 question but ...

Say I have two classes -

RAID.m   and   RAIDstatus.m

And I have a variable in RAID.m that holds a color.

How do I get RAIDstatus.m to find out what is in that variable, held in another class (RAID.m) ?

Is it possible to get the contents of a variable from another class?



Thanks



Matt Egan



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Getting a variable from another class
      • From: email@hidden
References: 
 >Getting a variable from another class (From: Matthew Egan <email@hidden>)

  • Prev by Date: Re: Releasing Object belonging to Core Data transient attribute
  • Next by Date: Re: Getting a variable from another class
  • Previous by thread: Re: Getting a variable from another class
  • Next by thread: Re: Getting a variable from another class
  • Index(es):
    • Date
    • Thread