公共属性不是子类

时间:2016-09-16 13:26:14

标签: objective-c

有没有办法阻止类的public @property可用于该类的子类?

目前,我有一个类及其子类。子类使用了很多其父属性,但是有一些属性我只希望父拥有:在编写代码时,子类甚至不能调用这些受限制的属性。

长话短说,这将使得使用课程&它的任何子类“安全”。

远程可能吗?

1 个答案:

答案 0 :(得分:2)

通过在.m文件中声明属性,使属性成为私有属性

@interface ClassName ()

@property (nonatomic, strong) NSArray *myproperty;

@end

@implementation ClassName

@synthesize myproperty;
相关问题