• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Abstract class

 
Jacob Michaels
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was taking one of Marcus Green's exams and it said this:
"Any class derived from an abstract class must either define all of the abstract methods or be declared abstract itself"
Does this mean when I extend an abstract class, I can declare all of my methods in the new class abstract, and I don't have to declare the new class abstract.
Thanks
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your new class will have to be abstract if it has any abstract methods. Even without any abstract methods you have the option of declaring it abstract.
Bill
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wonder whether "define" in this sentence means "implement".
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I think Marcus' choice of words is poor.
I would phrase it as:
"Any class derived from an abstract class must either implement all of the abstract methods or be declared abstract itself"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic