Monday, January 28, 2019

oop - 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?



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.


Answer



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).


No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...