Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static methods

 
sonali rao
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can static methods be orver ridden?
 
Sindhur Sat
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NO
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, but they can be hidden. Static methods are not polymorphic. Consider the following:

In this scenario, instances of C can accesses any of the static methods by qualifying the call with the class:

But now C can no longer access the instance methods of A since a super call only applies to B. In the above example, if the class qualifier is removed, then the hidden static method defined in the subclass will be called or the most immediate super class that hides the static method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic