Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

does an abstract method require an abstract class?

 
Mike Noel
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have a method marked as abstract it seems to make sense that the class would also have to be marked abstract. Right?
 
Doyle Matt
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
marked method?

are you referring to annotations? if not then is a method is "declared" abstract then its class declarations should also be "declared" abstract as well.
 
Mike Noel
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, sorry for the confusion. I mean declared abstract.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... or it should not be a class but interface.
 
Revathi Velu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a method is abstract then the class containing the method MUST be abstract. You cannot have an abstract method inside a non-abstract clas.

The converse however is not true. You can have one or all non-abstract methods inside an abstract class.

Hope this helps.

Revathi
 
Douglas Chorpita
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great job, Revathi!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic