Question: I have ClassA and ClassB, with ClassA being the superclass.

ClassA uses NodeA, ClassB uses NodeB.

First problem: method parameters. ClassB needs NodeB types, but I can't cast from the subclass to the superclass. That means I can't set properties which are unique to NodeB's.

Second problem: When I need to add nodes toClassB, I have to instantiate a new NodeB. But, I can't do this in the superclass, so I'd have to rewrite the insertion to use NodeB.

Is there a way around it or am I gonna have to rewrite the whole thing?

Answer: 
Use the [add](http://api.jquery.com/add/) method:

```
$elem.add($elem2).show();

```
This worked for me:

```
var element1 = $('#element1'),
    element2 = $('#element2'),
    element3 = $('#element3'),
    element4 = $('#element4');

$([element1[0], element2[0], element3[0], element4[0]]).my_function();  

```

and had after some performance testing a way better result than this:

```
element1.add(element2).add(element3).add(element4).my_function();

```