Encapsulation of functions | Purpose in terms of OO
<p>Encapsulation is the core tenent of OO programming.</p>

<p>However, if you make a function private and then you return it so that you can use it, does this to anything effectively.</p>

<p>I would think not, that b.c. if you return a function , you are not returning a copy of it...you are returning a reference.  That is the core of the question.  When you return a function is it a copy or is it a reference to the actual function.</p>

<p>Does the code below keep func1 private and safe as good practice OO programming would like.</p>

<p>Or does encapsulation / data hiding not really pertain to functions?</p>

<pre><code>var A = (function(){
    var func1 = function(param){
        // do stuff
        },
        publik;
    publik.retFunc(){
        return func1;
    }
    return publik;
}())

A.retFunc()(arg1);
</code></pre>
