• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

abstract override of implemented method?

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mooh...

In one of the pre-assessment exams on the internet I stumbled across an explanation belonging to a certain question which stated that is possible to make an abstract override of an implemented method. I verified it and it is indeed possible to do that, but what's the use of it. I fail to see the logic of it.

Jeroen de Wolf
 
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suppose if you want to make a 'family' of classes that have a common superclass, and you want the compiler to make sure you override a certain method because the inherited functionality isn't appropriate. I can't think of a real example where it would be useful, but why not.
 
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suppose there is family of classes with an abstract superclass. Suppose that the Object.equals() method is definitely wrong for this family but each class must define equality differently.
Putting "public abstract boolean equals(Object obj);" in the superclass forces each subclass to define an appropriate equals() method.
 
reply
    Bookmark Topic Watch Topic
  • New Topic