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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a piece of code that looks like this
abstract public class super
{
public void meth(){absMeth();}
abstract void absMeth();
}
public class sub extends super
{
protected void absMeth(){print something}
}
then when i run the meth method of sub nothing gets printed out shouldnt this work?
[ August 07, 2002: Message edited by: Gyutae Kim ]
[ August 07, 2002: Message edited by: Gyutae Kim ]
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gyutae,
Try this:

Hope this helps,
Michael Morris
 
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gyutae,
You have attempted to use the keyword "super" as a class identifier. You need to change the name of your class.
If you want to put both class declarations in the same file, then you need to make sure that only one is declared public.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
then when i run the meth method of sub nothing gets printed out shouldnt this work?
Yes, Gyutae, such a structure should work. You perhaps have an error in your code. What is the code that you're trying to compile and run?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic