Scope modifiers: Difference between revisions

→‎{{header|Delphi}}: Adds Déjà Vu example
(Add Logtalk implementation)
(→‎{{header|Delphi}}: Adds Déjà Vu example)
Line 226:
strict protected</lang>
Private and Protected members of a class are visible to other classes declared in the same unit. The "strict" modifier was added in Delphi 2005 to treat public and private members as private and protected, even from classes declared in the same unit.
=={{header|Déjà Vu}}==
 
Variables are lexically scoped in Déjà Vu. Doing a <code>set</code> or a <code>get</code> starts looking for <code>local</code> declarations in the current scope, going upward until the global scope. One can use <code>setglobal</code> and <code>getlocal</code> to bypass this process, and only look at the global scope.
<lang dejavu>set :a "global"
if true:
!print a
local :a "local"
!print a
!print getglobal :a
!print a
</lang>
{{out}}
<pre>global
local
global
global</pre>
 
=={{header|E}}==
Anonymous user