clone() limitations
lYou cannot do this:







as clone() is not visible for Objects in general.

lI could find no way to implement a general static method that will check dynamically whether an Object implements Cloneable, then call clone(). There may be a kludgy way.



static Object cloneIt(Object ob)
{
try
    {
    return ob.clone();
    }
  catch( CloneNotSupportedException e)
    {
    return ob;
    }
}