• 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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: 62231
193
  • 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: 3797
40
  • 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: 3797
40
  • 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.
 
Live ordinary life in an extraordinary way. Details embedded in this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!