Well I'm still at it and would like to share my congress (I think I'm regressing). Despite that, I am able to get the following to compile but the program is unresponsive (no effect of button press).
To sum up my revisions, I made changes relative to my statement of 2 weeks ago:
From what I understand about Cocoa and Objective-C you would make a class that contains this "win" function/method, create an instance of the class, and tell it to run the method.
After implementing that (ASecondClass *aSecondClassInst), I deleted the single IBOutlet declaration in the AFirstClass Interface file that was linked to the ASecondClass Instance in IB. I no longer think the instances of these classes in IB need to be connected. They are still connectected to the rest of the Interface however (Button -> AFirstClass & ASecondClas -> *textOut). That got rid of the error: "
parse error before 'ASecondClass'" that I had detailed two weeks previouse. I don't rely understand why but I draw my conclusion through cause and effect.
So now I have a compilable pile who's resulting application's sole user interface element is unresponsive:
/* AFirstClass */
#import <Cocoa/Cocoa.h>
@interface AFirstClass : NSObject
{
//Declaration was buggin out
}
- (IBAction)messageToSecondAct

id)sender;
@end
#import "AFirstClass.h"
#import "ASecondClass.h"
@implementation AFirstClass
- (IBAction)messageToSecondAct

id)sender
{
ASecondClass *aSecondClassInst;
aSecondClassInst = [[ASecondClass alloc] init];
[aSecondClassInst writeOnCommand];
}
@end
/* ASecondClass */
#import <Cocoa/Cocoa.h>
@interface ASecondClass : NSObject
{
IBOutlet NSTextField *textOut;
}
- (void)writeOnCommand;
@end
#import "ASecondClass.h"
@implementation ASecondClass
- (void)writeOnCommand
{
[textOut setStringValue:@"It worked"];
}
@end
To restate my question,
"How do I write a method that calls upon another object's method"
I understand this to be similiar to nested functions. I don't need this example to work, I understand it might be backwards. I've written it only to showcase my dilema in brevity.