• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

abstract

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

i have a question here.


if a calss is abstarct, then the class that extends the abstract class should implemnt all the methds. or the class itself should be declared as abstarct.



how come this program compiles and generates an ouput?
here class is abstarct, public void another() is also considered as abstract? is that so. eventhough not declared as abstract. cos class is abstarct. n only MYFUNC IS THE OUTPUT HOW?

unable to understand this anyone please explain it.



Edited by Corey McGlone: Fixed misspelled subject and added CODE tags.
[ May 28, 2004: Message edited by: Corey McGlone ]
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An abstract class can define both abstract and non-abstract methods. Any subclass of an abstract class must either implement all of the abstract methods defined in the superclass or it must also be declared as abstract. There is no need for the subclass to override the non-abstract classes in the parent class.

In this example, the subclass does define a body for the one and only abstract method. There is no requirement to override the other method.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic