Se följande kod:
public class BinaryTree
{
public void merge( Object rootItem, BinaryTree t1, BinaryTree t2 )
{
if( t1.root == t2.root && t1.root != null )
{
System.err.println( "leftTree==rightTree; merge aborted" );
return;
}
// Allocate new node
root = new BinaryNode( rootItem, t1.root, t2.root );
// Ensure that every node is in one tree
if( this != t1 )
t1.root = null;
if( this != t2 )
t2.root = null;
}
private BinaryNode root;
}
Vad är this i denna kontext? Brukar ju användas som this.nånting ?
------------------
Med vänliga hälsningar
Tobias Bohlin