forum

Home / DeveloperSection / Forums / I misunderstanding Encapsulation rules in objective c.

I misunderstanding Encapsulation rules in objective c.

Tarun Kumar163920-Aug-2015

I will explain my question from an example.

In .H file//

@interface Employee:NSObject {

@private NSString *name;

}

@property(nonatomic,retain) NSString *name;

@end

in .M file//

@implementation {

@synthesize name; 

}

 

In this scenario when i access the name property within another class , like myEmp.Name = @"John"; it doesn't raise any issue. Does this according to the encapsulation rules or am I misunderstanding?


Updated on 21-Aug-2015

Can you answer this question?


Answer

1 Answers

Liked By