I want to assign value for NSString *just which is in the Second NSObject from the First NSObject and I want to access the Assigned value from the Viewcontroller.
I tried the above code It doesn't work for me.
It returns null
What i am doing wrong??
This is my first Viewcontroller :
#import <UIKit/UIKit.h>
#import "First.h"
#import "Second.h"
@interface testAppViewController : UIViewController
{
First *F;
Second *S;
}
@end
This is my .m of Viewcontroller :
F =[[First alloc]init];
[F Add];
NSLog(@"Second value==> %@",S.Just);
This is my First NSobject class.h
@interface First : NSObject
{
Second *S;
}
-(void)Add;
This is First NSObject class.m
#import "First.h"
@implementation First
-(void)Add{
NSString *c;
c =@"hi";
S=[[Second alloc]init];
[S setJust:c];
}
@end
This is my Second NSobject .h
@interface Second : NSObject
@property(nonatomic,strong)NSString *Just;
@end
This is Second NSObject .m
@implementation Second
@synthesize Just;
@end