• 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 method

 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
statement : an abstract method can be overridden by an abstract method

the basic puppose of overriding is to change the body of method

what is the use of it or what is the need to override an abstract method
with an abstract method, other than declaring fewer exceptions
 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And you can increase scope also ...
private -> default -> protected -> public
 
shandilya popuru
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks rathi ji

i figured it out later
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

private -> default -> protected -> public



you can do this for an overriden method? I thought that was ok for overloaded but not for overriding.
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


the basic puppose of overriding is to change the body of method



Not quite true. Interface methods are abstract, and have no body.
Some (including myself) argue that overriding concrete methods is pure evil.
In fact, some (again, including myself) take it to what is perceived by majority as an extreme (due to decades old preconceptions) and demand that inheriting from concrete implementation be totally outlawed. Of course, this implies that all classes are declared final (and therefore, not abstract) and that the only abstract methods are also virtual i.e. members of interfaces. I take it one step further (encapsulation is paramount) and demand that all constructors be declared private (constructors violate encapsulation).

Better stop ranting and go play, it's Saturday.
I got a new set of Metzeler Z6's on my bike and they need "breaking in".
Bye!!
 
Tell me how it all turns out. Here is a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic