-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
1.4.1
-
x86
-
windows_2000
Name: nt126004 Date: 04/21/2003
A DESCRIPTION OF THE REQUEST :
A feature of Delphi (but not C or C#) is to allow a class's implementation of one or more interfaces to be delegated to one of the classes properties. This is done using the following format in the class definition:
TMyClass = class(TObject, IMyInterface)
... (the rest of the class definition)
public
property MyInterface: IMyInterface read FMyInterface implements IMyInterface;
end;
There are many ways this could be added to Java. One possible form for this might be something like this:
public class MyClass implements InterfaceA, InterfaceB, InterfaceC {
private final implements InterfaceA, InterfaceB obj = new SomeObject();
... (the rest of the class definition)
}
JUSTIFICATION :
This approach has proven quite useful in Delphi in that it allows you to come closer to true multi-inheritance without encountering many of the problems of multi-inheritance. It also allows for multiple classes to share the same implementation of an interface. It would also help to give Java a competitive edge over C#.
(Review ID: 182667)
======================================================================
A DESCRIPTION OF THE REQUEST :
A feature of Delphi (but not C or C#) is to allow a class's implementation of one or more interfaces to be delegated to one of the classes properties. This is done using the following format in the class definition:
TMyClass = class(TObject, IMyInterface)
... (the rest of the class definition)
public
property MyInterface: IMyInterface read FMyInterface implements IMyInterface;
end;
There are many ways this could be added to Java. One possible form for this might be something like this:
public class MyClass implements InterfaceA, InterfaceB, InterfaceC {
private final implements InterfaceA, InterfaceB obj = new SomeObject();
... (the rest of the class definition)
}
JUSTIFICATION :
This approach has proven quite useful in Delphi in that it allows you to come closer to true multi-inheritance without encountering many of the problems of multi-inheritance. It also allows for multiple classes to share the same implementation of an interface. It would also help to give Java a competitive edge over C#.
(Review ID: 182667)
======================================================================
- duplicates
-
JDK-4191243 Method forwarding - Subclassing without subtyping
-
- Closed
-