This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Question about abstract classes  RSS feed

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the question 908912 of Kaplan.

I have the following abstract class




This is  a type that implements this class




This type is wrong because a class only can extend another class. In the case, we use extends, why this type is wrong?
 
Marshal
Posts: 63314
205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably because it says implements whereas, as you said correctly, it should read extends if followed by the name of a class.
 
Carlota Vina
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I will use extends, will this be right?
 
Rancher
Posts: 3915
45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried it?
 
Carlota Vina
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I implemented these classes and I get errors. I must implement the two methods :

 
Dave Tolls
Rancher
Posts: 3915
45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct.
That's because, even though the ByteCaesarCipher class has encrypt and decrypt methods, those methods do not have signatures that match those in the abstract class, so are not implementations of those abstract methods.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!