This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can we mark an overriding method as abstract

 
Simran Dass
Ranch Hand
Posts: 183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can we mark an overriding method as abstract ?


Cannot understand how the code in class B works. Why would we want to do this
 
Henry Wong
author
Marshal
Pie
Posts: 20836
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simran Dass wrote:
Cannot understand how the code in class B works. Why would we want to do this


Basically, you want to create a new class that IS-A a particular sub class, but you don't have the complete implementation. Or you have multiple possible implementations, of which the subclass implementation is not one of them.

Granted, it is not a common case, but it can happen.

Henry
 
Simran Dass
Ranch Hand
Posts: 183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yeah. Thanks for the quick reply.
 
Prithvi Sehgal
Ranch Hand
Posts: 774
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In what cases, such a scenario can happen? I find this quiet meaningless. Umm that too marking an instance method as abstract.
Doesn't it violate the rules of overriding?

Best Regards,
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code if fine, but useless and I think that it violates the LSP principle a little, but it depends on the interpretation.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic