History of access control modifiers such as public/private/protected

半腔热情 提交于 2019-12-04 22:41:40
Henk Holterman

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.

And, with thanks to Pavel, Simula introduced the most important keywords (and concepts) of class, this, new, downcasting and reference types.

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.

The first use of Properties was, as far as I know, in Delphi (Object Pascal, < 1994).

public, private and protected access modifiers come from C++. It seems that public and private already existed in "C with classes", short lived precursor of C++. This is probably detailed in The design and Evolution of C++.

I think abstract and final come from Java and internal from C#.

this sort of thing starts out with multiple language designers asking 'what's a simple, logical name for this concept'? then, over time certain names become popular (sometimes because they're good names, sometimes just because). add 20 years, and most people end up picking the same names, based on what they've seen.

a similar question, perhaps, to asking how new words get added to (say) the English language.

For C++, the origins of private and public protection come from before Stroustrup's experiments with C With Classes, but from an even older system - the Cambridge CAP computer. This is described in section 2.10 of "The Design & Evolution of C++".

As for protected, that has had a murkier past & I don't have a good reference for it.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!