gpt4 book ai didi

delphi - 使 "private"成员表现得像 "strict private"

转载 作者:行者123 更新时间:2023-12-03 18:54:26 26 4
gpt4 key购买 nike

即将推出的 Delphi 版本中启用该功能的功能怎么样?

也许它可能是一个编译器开关,促进所有 ** private **s to ** strict private **小号。

... 或者它可能是新的 non-legacy compiler font-end 的一个特性尼克霍奇斯正在谈论。 => private 总是表现得像 strict private .

编辑:我之所以想要这个是因为我只是不想添加数千个strict给我的private修饰符。此外,“严格私有(private)”行为是我熟悉的任何面向对象语言的默认行为!

最佳答案

引用文章:

So, we are working to create a “new Delphi” and a new compiler architecture, to keep your existing code working, to emit 64-bit binaries using both Delphi and C++Builder, and maybe a few other kind of binaries while we are at it. And it all has to be done right so that it all works for you.



我将其解释为,如果 codegear 要改变 private 的行为。然后他们将提供一个选项来保持旧的行为,就像他们过去所做的那样。

只是为了澄清,在一个类中有 6 个不同的访问级别(好的 7,但不推荐使用自动化)。
public: Anything that can access the object can access this.
protected: Methods in the class and its subclasses and anything in the same unit can access.
strict protected: Methods in the class and its subclasses can access.
private: Methods in the class and anything in the same unit can access.
strict private: Methods in the class.
published: As public buth with runtime information for the object inspector.

关于delphi - 使 "private"成员表现得像 "strict private",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/759896/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com