• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

help with Virtual methods!!

 
Ranch Hand
Posts: 60
  • 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
 
Ranch Hand
Posts: 68
  • 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
  • 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,
 
author
Posts: 23834
140
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks to all of you
respect,
Ammar
 
author
Posts: 14112
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you ,Ranchers
 
Ammar Salem
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you,Ranchers
Regards
Ammar
[ January 23, 2008: Message edited by: Ammar Salem ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!