Extend a function - merge two functions?
<p>I am in some new territory now, I haven't worked with this sort of thing in a while.</p>

<p>What is the best way to have a Javascript 'class' for instance </p>

<pre><code>// In the parent instance
function xyz()
{
    var x = 1;
}
</code></pre>

<p>I want to set this in the class, and when a user extends a class, I want them to effectively be extending this function. I know I'm not being clear, but it's been a long day. This is the user's code for instance.</p>

<pre><code>// In the child instance
function xyz()
{
    var y = 2;
}
</code></pre>

<p>Merging should result in:</p>

<pre><code>// In the merged instance
function xyz()
{
    var x = 1;
    var y = 2;
}
</code></pre>

<p>Am I smoking the wrong stuff or asking the wrong question?</p>
