void moveDisks(int n, Tower& dest,Tower& buffer){ if(n>0){ moveDisks(n-1,buffer,dest); moveTopTo(dest); buffer.moveDisks(n-1,dest,*this); } }
void MoveDisks(int n, Tower d, Tower buffer) { if( n > 0 ) { // put n-1 elements to the buffer Tower MoveDisks(n - 1 , buffer, d); // move one last element to the destination MoveTopTo(d); // put those n-1 back to the destination Tower! buffer.moveDisks(n-1, d,this); // Done } }