Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Cloning a generic object

843793Feb 21 2005 — edited Feb 21 2005
Are generic objects nothing like templates objects? Because I can't understand why and how to get it to resolve to the right clone method, ie not call the protected object class's clone method verse the subclass class T's clone method. Here's my code. Pleae help anyone thank you.
public class Table< T > extends Vector< T >
{
	private class Row< T >
	{
		public Row( T e )
		{
			element = e;
			mirror = ( T )e.clone();
		}

		private T element;
		private T mirror;
	}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 21 2005
Added on Feb 21 2005
8 comments
620 views