[jdom-interest] Moving Children
Frank.Sauer at trcinc.com
Fri Jun 15 13:36:14 PDT 2001
Sorry, you guys are correct. As I said, it WAS
a long night....
How about using reflection?
Method c = = whatever.getClass().getMethod(...... <clone> ....)
Would that work?
The Technical Resource Connection, Inc.
a wholly owned subsidiary of Perot Systems
Java: The best argument for Smalltalk since C++
From: Alex Rosen [mailto:arosen at silverstream.com]
Sent: Friday, June 15, 2001 4:17 PM
To: 'Frank Sauer'; 'Jason Hunter'; 'Eric Rosenberg'
Subject: RE: [jdom-interest] Moving Children
> Maybe I'm completely confused (it has been a long night)
> but if you call :
> won't that result in a call to the actual overridden clone() in the
> actual class of whatever?
No, it will give you a compiler error. No matter what object "whatever" is
runtime, you're calling it as an Object, and Object.clone() is protected.
Sun has acknowledged that clone() is screwed up. No matter what you try, you
can't clone an object unless you know its type beforehand (at compile-time).
More information about the jdom-interest