This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Please suggest how to inherit static method from class and override one method among that?  RSS feed

 
jacob deiter
Ranch Hand
Posts: 587
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class(A) with some static methods, I want to inherit all the method of class A and override one Method. Overriding Static method is not possible,

Please suggest how to inherit static method from class and override one method among that?
 
Antany Vasanth
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Jacob,

Please refer the below thread. It will give some idea about static methods and its usage in subclasses.

http://www.coderanch.com/t/456150/Java-General/java/All-about-static-methods

Regards,
Antany
 
Vijitha Kumara
Saloon Keeper
Posts: 3998
42
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jacob deiter wrote:I have a class(A) with some static methods, I want to inherit all the method of class A and override one Method. Overriding Static method is not possible,


Yes, You can't override static to be non static in the subclass (OverridingVsHiding). Of course you can hide the methods by redefining them in the sub class (as static methods). If you expect the runtime polymorphism with those method, well you may have to look other options depending on your requirement.
 
Campbell Ritchie
Marshal
Posts: 55751
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
People have already told you it is not possible to override static members. You have some very bad design if you are even thinking of doing that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!