Users Pricing

forum

Home Forums I misunderstanding Encapsulation rules in objective c. – MindStick

I misunderstanding Encapsulation rules in objective c.

Tarun Kumar 2039 20 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?


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md