• 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 an interface?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scope in an interface?


  • Subject: Scope in an interface?
  • From: Graham Reitz <email@hidden>
  • Date: Sun, 25 May 2008 00:29:30 -0500


I am coming from the c++ world and I feel I don't understand how objects are scoped in obj-c.


What is the scope of m_controller (a c++ class) below? The debugger shows m_controller as {...} with no other information. Other than that it seems to run fine.

Can I think of an @interface as something similar to a c++ class?

Also, is there some reading for people familiar with c++ trying to grok obj-c other than the apple dev docs? (something quick and dirty)

// simple.h

#include "controller.hpp"

@interface simple : NSView
{
    @private
        controller m_controller;
}

- (void) initialize_something;
- (void) drawRect: (NSRect) rect;

@end

// simple.mm

- (void) initialize_something
{
    m_controller.initialize_something();
}

- (void) drawRect: (NSRect) rect
{
    NSLog(@"drawRect");
    m_controller.do_something();
}
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Scope in an interface?
      • From: Jens Alfke <email@hidden>
    • Re: Scope in an interface?
      • From: Ken Thomases <email@hidden>
    • Re: Scope in an interface?
      • From: "stephen joseph butler" <email@hidden>
  • Prev by Date: Re: to launch safari with an URL
  • Next by Date: Re: Scope in an interface?
  • Previous by thread: Re: to launch safari with an URL
  • Next by thread: Re: Scope in an interface?
  • Index(es):
    • Date
    • Thread