Making apps with future extensions Programming Software Development by Cudmore …); } [/CODE] I know this doesn't work. I get a ClassCast exception. So, I can't use the interface like that… Re: Need help on my code .. Programming Software Development by stultuske …) to name your files. two remarks: instead of throwing a ClassCast exception in your compareTo method, just return false (that is… ClassCast question Programming Software Development by c++noobie I have a simple class called DateTime because I'm doing some interface with a C# web service. I wanted to override the Date class' toString method as shown below in order to serialize it in a way C# understands, so I wrote a simple little wrapper class. The problem comes when trying to cast a Date type as DateTime. Is there any way to do something … Re: ClassCast question Programming Software Development by coil The reason you're getting errors is because Calendar has no relation to DateTime. If you want to override the Date class' toString(), then why not just use the DateTime class that you've already created? Either that, or directly extend Calendar and use that. Re: ClassCast question Programming Software Development by c++noobie Calendar.getInstance().getTime() returns an object of type Date. I still don't understand why the above explicit cast doesn't work. Trying to directly extend Calendar, I get a series of required methods that I can't pass off to the super class because it's all abstracted. I tried using GregorianCalendar instead and still get the same casting … Re: ClassCast question Programming Software Development by JamesCherrill Casting to a subclass of the objects actual type doesn't work. The subclass may contain variables and constructor code that the superclass does not have, so simply pretending its a subclass instance isn't going to work. You can create a kind of copy constructor like this: [CODE] public DateTime(Date d) { super(d.getTime()); … Re: Making apps with future extensions Programming Software Development by Cudmore Here's an example I wrote that [I]works[/I], but it's primitive. TestExtension.java [CODE] public class TestExtension { public static String retClassName () { return "Class Name: TestClass"; } } [/CODE] Tester.java [CODE] public class Tester{ public static void main (String[] args) { try { Class loaded = … Re: Making apps with future extensions Programming Software Development by jwenting You can actually do pretty much just that, you've almost succeeded in creating your own plugin architecture. Congratulations on that, it takes many people years to figure out (if they succeed at all). What you're looking at is an abstract factory to create adapters. What you need is to create an interface (abstract baseclass would work as … Re: Making apps with future extensions Programming Software Development by Cudmore :eek: OH - MY - GOSH. :cheesy: I figured it out. I think it's been about a total of.. hmm.. 10 hours, now, trying to get this? I've been playing with it all morning, and it finally compiled and ran as expected. All I needed to do was IMPLEMENT the interface -- something I overlooked. Gah. Thanks, jwenting. Your comment gave me hope and prevented … Re: Making apps with future extensions Programming Software Development by Cudmore It won't let me edit my previous post, so.. Incase anyone noticed in my code, in the main function I said... [CODE]public static void main () { // Dunno why, but can't get this to run under SuSE 10.1 // No matter how I enter the args to the 'java' command, // "Exception in thread "main" java.lang.NoClassDefFoundError"[/… Re: Making apps with future extensions Programming Software Development by Cudmore ................................................. (Delete this -- Accident Post) ................................................. Re: Making apps with future extensions Programming Software Development by Rotak [QUOTE=jwenting] What you're looking at is an abstract factory to create adapters. What you need is to create an interface (abstract baseclass would work as well but is far less flexible) which defines the methods that you need for your plugins to function.[/QUOTE] I used a 2-interface-version, which made everything much more flexible and …