Re: Forcing sub-classes to implement Constructor
Roger Jakobsen <[email protected]>
| Newsgroups | gmane.comp.windows.devel.java.advanced |
|---|---|
| Message-ID | <[email protected]> |
On 8/9/07, Dmitry Beransky <[email protected]> wrote: > > On 8/9/07, Roger Jakobsen <[email protected]> wrote: > > Is there a way to force subclasses of a class to implement a certain > (read > > empty) constructor. > > No, this is not possible. > > If I may put forth a bold statement: if you finding that you need to > do this, you may want to take a step back and re-evaluate your design. > Could you describe what you are trying to do in more detail? I'm > curious if there is a real use case for this. > > > Regards > Dmitry > > > We have this JMS implementation. The messages are classes that inherit from the NetMessage class. The NetMessage class defines multiple abstract methods like readFromStream(...) and writeToStream(...), etc. Now, if someone issues a NetMessage without an empty constructor the JMS implementation will be unable to re-create, or instantiate, it on the receiving side. It would be nice to force subclasses to implement an empty constructor. Roger =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com