• 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: Executing methods in one class from within another
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Executing methods in one class from within another


  • Subject: Re: Executing methods in one class from within another
  • From: Alexander Reichstadt <email@hidden>
  • Date: Tue, 11 Jun 2002 19:06:14 -0700

That's kind of tricky with giving examples in terms of code. Let me try to explain, it's a general condition that I am certain is trivial to many of you, think basic, chances are I missed some piece at the lower level

I have some app, document based or not is not of concern, I think. In my app I have two NSObject subclasses, myClassA, myClassB. myClassA has an accessor, let's say for some NSString -(NSString *)myString. Now, if I need to retrieve the value that is currently in this string, but need to do so in myClassB, I don't know how to go about this, if instances of myClassA and myClassB were created at the same level, so that I could not say #import myClassA in myClassB and #import myClassB in myClassA, which, of course, gives me a compiler error. I can either do the one or the other, but not both. myClassA doesn't, at this stage, 'possess' an instance of myClassB, and neither vice versa, so I have problems having the two accessing values from each other if I do not have some central switchboard widget that allows me to get hold of one from within the other.

Is that clearer now?

Thank you
Alex


On Tuesday, June 11, 2002, at 05:17 PM, mmalcolm crawford wrote:

From: mmalcolm crawford <email@hidden>
Date: Tue Jun 11, 2002 05:17:54 PM US/Pacific
To: alex <email@hidden>
Cc: Cocoa Dev <email@hidden>, email@hidden
Subject: Re: Executing methods in one class from within another

On Tuesday, June 11, 2002, at 05:05 PM, alex wrote:

we have problems figuring out a way to access a method in one class form within another.

Umm, I have problems figuring out exactly what it is you're trying to achieve here -- could you give an example...?

in an earlier project, managed to do so by subclassing NSApplication

You almost certainly should not be doing that...

I have done some searching but didn't come up with anything useful. The documentation on NSApplication is nto very helpful.

.. which is probably why the documentation isn't being very "helpful".

mmalc
_______________________________________________
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: Executing methods in one class from within another
      • From: Robert Goldsmith <email@hidden>
    • Re: Executing methods in one class from within another
      • From: Richard <email@hidden>
References: 
 >Re: Executing methods in one class from within another (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: Thoughts on CodeWarrior 8 for Cocoa programming?
  • Next by Date: Re: Executing methods in one class from within another
  • Previous by thread: Re: Executing methods in one class from within another
  • Next by thread: Re: Executing methods in one class from within another
  • Index(es):
    • Date
    • Thread