Cloneable interfaces at Linux
hmm, i dont quite understand what the Cloneable interface is for?
i have an abstract class
with a bunch of sub classes
It's there to indicate that your class is in fact clonable
and some of them are cloneable
so, when trying a clone and wanting to verify that the object is infact cloneable
you get an exception
CloneNotSupportedException, right?
well, no because i know it throws that
i do if (obj instanceof Cloneable)
which determines if the class actually implements the interface
Don't explain java code to me ![]()
heh sorry
Tell me what the problem is
but what then? i cant seem to call the public clone method without casting it to the specific types implementing cloneable
and a public clone method
i thought the Cloneable interface would actually implement this method so I could use it
Then either implement it on the base class or have something on the base class that delegates the call
easy peasy ![]()
er.. what?
alright thanks
Interfaces don't implement methods
they declare their existence
yea
what i meant, sorry
or a requirement really
heh
Action: jjava giggles hysterically
your sub-classes that are Clonable, all have to implement the clone()-method
or have one provided for them through a common base class
yea
but then if implementing clone in the base class, i wouldn't know which of the sub classes that actually have a valid clone method
so i'd have to catch the exception of calling clone() ?
er.. they all do in that case
catching the exception is unrelated
CNSE is a check exception and is therefor mandatory to catch and/or re-throw
er.. declare throws
ah alright
thanks