Break OO privacy: Difference between revisions

m
Added Sidef
(→‎{{header|J}}: not the venue for polemics)
m (Added Sidef)
Line 993:
println(foo)
}</lang>
 
=={{header|Sidef}}==
Sidef's object model does not enforce privacy, but it allows storing private attributes inside the container of an object, which is an hash:
<lang ruby>class Example {
has public = "foo"
method init {
self{:private} = "secret"
}
}
 
var obj = Example();
 
# Access public attributes
say obj.public; #=> "foo"
say obj{:public}; #=> "foo"
 
# Access private attributes
say obj{:private}; #=> "secret"</lang>
 
=={{header|Tcl}}==
2,747

edits