单独在.h文件的interface()方法中定义变量而不综合它有什么区别?

发布于 2024-10-11 05:22:20 字数 354 浏览 0 评论 0原文

我在 .h 文件的接口方法中定义一个变量,如下所示...

@interface ......{
int a;
}

然后我在 .m 文件中使用它,它工作正常....

我还修改了 .h 文件中的代码

@interface ......{
int a;
}
@property(nonatomic) int a;

,并在 .m 文件中设置了int value as

@synthesis a;

现在也可以正常工作...

这两种情况有什么不同?

谢谢

I define a variable in .h file's interface method like this...

@interface ......{
int a;
}

Then i use it in .m file, it works fine....

Also i modified the code as

@interface ......{
int a;
}
@property(nonatomic) int a;

in .h file, and in .m file i set the int value as

@synthesis a;

Now also it works fine...

What is the different between both cases?

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文