访问控制修饰符的历史,例如公共/私有/受保护的 [英] History of access control modifiers such as public/private/protected
问题描述
这些关键字和概念是如何变成现实的?是什么使它们出现的力量和问题?拥有它们的第一种语言是什么?
How did these keywords and concepts come to life? What were the forces and problems that made them appear? What was the first language to have them?
实际上,它不仅是关于public
/private
/protected
的关键字,而且还包括执行某些规则(abstract
,final
,internal
)的整个关键字范围.
Actually, it's not just about public
/private
/protected
, but rather the whole range of keywords that enforce some rules (abstract
, final
, internal
).
但是,请不要承担任何责任.如果您至少知道答案的一部分,请回答;如果您住了那一刻,请回答.参考文献不胜感激.
But, please, do not assume things. Answer if you know at least part of the answer or answer if you lived those moments. References are greatly appreciated.
推荐答案
Simula(1967)被认为是第一种OO语言,具有名为 的修饰符>受保护的和隐藏的 .我以为public是默认设置,我不记得了.它还使用虚拟.
Simula (1967), considered to be the first OO language, has modifiers called protected and hidden. I assume that public is the default, I can't remember. It also uses virtual.
并且,感谢Pavel,Simula引入了 class , this , new ,垂头丧气和参考类型.
And, with thanks to Pavel, Simula introduced the most important keywords (and concepts) of class, this, new, downcasting and reference types.
Smalltalk(1980年)(一种后来出现但更基础的面向对象语言)为我们提供了方法对消息的响应.这基本上是与虚拟功能相同的功能.消息和类后来在C(非OO)中被模仿,以提供Windows API多态行为.但是仍然需要难看的开关语句和函数指针来代替继承.
Smalltalk (1980), a later but much more fundamental OO language, gave us Methods responding to Messages. This basically is the same functionality as virtual functions. Messages and Classes were later imitated in C (non-OO) to give the Windows API polymorphic behavior. But still needing ugly switch-statements and function pointers to replace inheritance.
据我所知,属性的首次使用是在Delphi中进行的(Object Pascal,< 1994).
The first use of Properties was, as far as I know, in Delphi (Object Pascal, < 1994).
这篇关于访问控制修饰符的历史,例如公共/私有/受保护的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!