Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

virtual functions

 
P.Praveen Jesudhas
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are virtual functions allowed in java
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Java supports polymorphism.
 
Prathap Adusumilli
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By default all the fucntions in java are virtual. In that if you are using a base call reference for an derived call object, the method in the derived class will be called (if its extended/implemented).
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I would say that all methods that can be overridden (i.e., non-static, non-private, and non-final) have the potential to be "virtual" in Java. But there is no "virtual" modifier, and the term is not commonly used in Java.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you could savely say that in Java all instance methods are virtual, all static methods aren't.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic