• 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
Public, private and protected variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Public, private and protected variables


  • Subject: Public, private and protected variables
  • From: John MacMullin <email@hidden>
  • Date: Sun, 27 Jul 2003 14:55:42 -0700

I have an NSDocument Object that I have subclassed and then I
subclassed the subclass. I have instance variables declared as public
and protected in the first subclass following Cocoa In a Nutshell, page
8, on scoping, as follows:

@public
NSMutableArray *companyRecords;
@protected
NSDictionary *ocAccountsFile;

In my first use in the subclass of the subclass, I am just trying to
get the variables referenced to print using NSLog. I do this by
sending a notification to the subclass. The notification works just
fine. Accessing the variables does not.

- (void)companyInfoTabSelected:(NSNotification *)notification
{
NSLog(@"Notification Action");
NSLog(@"%@-companyRecords", companyRecords);
NSLog(@"%@-ocCategoryFile", ocCategoryFile);
}

The result is:

2003-07-27 14:49:24.453 GLASS[6655] 2 tab view item
2003-07-27 14:49:24.454 GLASS[6655] Notification Action
2003-07-27 14:49:24.454 GLASS[6655] (null)-companyRecords
2003-07-27 14:49:24.454 GLASS[6655] (null)-ocCategoryFile

I have not been able to get the protected and public variables to
print, or be visible in any way, with a number of combinations
including accessor methods. I must be doing something wrong in a
simple way.

Any help would be greatly appreciated.

John
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Public, private and protected variables
      • From: Dylan Adams <email@hidden>
    • Re: Public, private and protected variables
      • From: Andy Lee <email@hidden>
  • Prev by Date: Memory Management
  • Next by Date: Re: Memory Management
  • Previous by thread: Re: Memory Management
  • Next by thread: Re: Public, private and protected variables
  • Index(es):
    • Date
    • Thread