• 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
Scope in a class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scope in a class


  • Subject: Scope in a class
  • From: Sanri Parov <email@hidden>
  • Date: Mon, 6 Jun 2005 22:07:24 +0200

Hi everybody.

I know Cocoa is very strict 'bout scoping, but I can't solve this.
The problem is I can't access a variable if I have allocated it into
another method.
In this example, from the "dummy" method, the variable d_dbase is out
of scope.
Why, if it's declared as public in the header file?
Thanks to all for the kind answers.


------------------H E A D E R   F I L E ------------------
@interface myGTEd : NSObject
{
	@public
	QuickLiteDatabase*	d_dbase;
}
@end
---------------------------------------------------------

------------------C L A S S    F I L E ------------------
@implementation myGTEd
- (IBAction)newDB:(id)sender
{
    d_dbase= [QuickLiteDatabase databaseWithFile:d_dbaseNome];
}

- (IBAction)dummy:(id)sender
{
   [d_dbase performQuery:@"SELECT creatore FROM datiGenerali;"];
}
---------------------------------------------------------


--
Sanri Parov
 _______________________________________________
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: Scope in a class
      • From: Jon Hull <email@hidden>
  • Prev by Date: Re: [Moderator] EOT Re: NYT confirms rumor of Apple switch to Intel
  • Next by Date: Re: [Moderator] EOT Re: NYT confirms rumor of Apple switch to Intel
  • Previous by thread: OT: Survey facing design patterns and communication
  • Next by thread: Re: Scope in a class
  • Index(es):
    • Date
    • Thread