Hi,
FYI I am very new to Java programming from a long time Delphi programmer...
Does java allow a mechanism to create a user defined type for a "class type"?
I am looking for a java equivalent of delphi "class of" declaration.
Delphi example...
type // define types for the following block of codes... TMyClasses = class of TMyClass; TMyClass = class(TObject) private FMyOtherClass: TMyClasses public class function TableName: string; virtual; abstract; // defines virtual method that must be overridden property MyOtherClass: TMyClasses read FMyOtherClass write FMyOtherClass; .... my class properties and methods... end; TMyClass2 = class(TMyClass) // inheritance public class function TableName: string; override; // ie. implemented as "Items" in source end ... TMyClass3 = class(TMyClass) public class function TableName: string; override; // ie. implemented as "Employee" in source end TMyClass21 = class(TMyClass2); ... public class function TableName: string; override; // ie. implemented as "Junk" in source end TMyClass31 = class(TMyClass3); ... public class function TableName: string; override; // ie. implemented as "Foo" in source end TBroClass = class(TObject)... var MyClass: TMyClass; OtherClass: TMyClass; ... MyClass := TMyClass.Create; // instantiate an TMyClass object // and I can do the following MyClass.MyOtherClass := TMyClass2; // assignment of just the class type ShowMessage(MyClass.MyOtherClass.TableName); // this will display a dialog box with message "Items" OtherClass := MyClass.MyOtherClass.Create; // this line will instantiate TMyClass2 MyClass.MyOtherClass := TMyClass31; ShowMessage(MyClass.MyOtherClass.TableName); // this will display a dialog box with message "foo" OtherClass := MyClass.MyOtherClass.Create; // this line will instantiate TMyClass31 MyClass.MyOtherClass := TBroClass; // this will have a compiler error for type incompatability
So, does java has something similar?
Thank you,