• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

nonpolymorphic use from a polymorphic setting

 
Ranch Hand
Posts: 128
MS IE Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way for an object of a subclass created by a superclass reference to use a superclass method , which is also overridden by the subclass, without using super() in the sub-method and without creating a new object?

If I'm not clear, please tell me. Thanks.
[ June 12, 2006: Message edited by: Allen Sylvester ]
 
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No.
 
Allen Bandela
Ranch Hand
Posts: 128
MS IE Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. If someone comes up with some way, please tell.
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest you seek the answer to a different question. That is what brought about this requirement and what could be changed to eliminate it. Needing to do what you wish is a clear indication that something is seriously wrong. Maybe your classes are too tightly coupled and too dependent on implementation. Maybe a subclass has overridden the method and not adhered to the contract as it should have, maybe the contract was fatally flawed to begin with. Regardless, the best advice I can give is to explain why you feel you need to do this and maybe someone here will have a better solution.
 
Allen Bandela
Ranch Hand
Posts: 128
MS IE Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was only thinking of such a possibility. I guess super() would be the best way to handle it. Thank you.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!