How to not expose class declarations (hiding them from the global namespace)?
<p>Good day.
I am facing a rather simple trouble. I hope the community will help me.</p>

<p>Here's what I have:
I have two JavaScript files: I have Parent class in the 1st, and Child class in the 2nd.
Now I'd like to hide these definitions from the global namespace. Of course, I could put them all into  single JavaScript file and wrap it into a self-invoking anonymous function like this so that there will be only one instance of the child object (what I am trying to achieve):
    </p>

<pre><code>var myChildObj = (function(){

    var ParentClass = function() {};    
    ParentClass.prototype = { 
        //some data
    };

    function extendsClass(childClass, parentClass, isRewrite) {
        for(var property in parentClass.prototype) {
            if (isRewrite || 
               (!isRewrite &amp;&amp; 
                !isDefined(childClass.prototype[property]))) {                         
                childClass.prototype[property] = parentClass.prototype[property];
            }
        }

        childClass.prototype.parent =  parentClass.prototype;
    }

    var ChildClass = function() {}; 
    ChildClass.prototype = {
        //some data
    }

    extendsClass(ChildClass, ParentClass, false);
    return new PhotoGallerySingle();    
})();
</code></pre>

<p>But ParentClass declaration is rather huge and it will be not so programmers friendly to put it all in there.</p>

<p>So, how do you usually go about solving such problem? Thank you.</p>
