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

help with Virtual methods!!

 
Ammar Salem
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello again friends,
what are virtual methods?? why do we need them? why, they are called Virtual? does that mean they do not exist? how they are invoked? I know that I have to show some effort people, but , it is not clear enough here in my book, I really could not grasp it at all.I can post my book explaination here but, i know it wouldnt help? I appreciate your help and effort.
Ammar salem
 
Daesung Park
Ranch Hand
Posts: 68
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't heard of "virtual" method in Java. Do you mean that of C++, or abstract method of Java?
 
Ammar Salem
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No Daesung Park , it is in my java book. and i dont know what to do with it
regards,
 
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
A virtual method (or function) is a distinction that doesn't really exist in Java. In C++, a virtual function is a function/method whose dispatch is determined at runtime -- basically, call the method based on the type of the object, not the type of the reference (pointer).

In Java, (instance) method calls are always dispatched at runtime. In other words, all non-static methods are virtual methods.

Henry
 
Ammar Salem
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks to all of you
respect,
Ammar
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With other words, virtual methods are methods that behave polymorphically. See also http://en.wikipedia.org/wiki/Virtual_function
 
Ammar Salem
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you ,Ranchers
 
Ammar Salem
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you,Ranchers
Regards
Ammar
[ January 23, 2008: Message edited by: Ammar Salem ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic