In short, "virtual function" is the C++ term for a polymorphic function/method. In Java, all (non-static) methods are polymorphic - there is no way to declare a "non-virtual function". [ July 11, 2002: Message edited by: Ilja Preuss ]

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus

Hi sandeep, The virtual modifier signals the compiler that this member function is expected to be overridden by a derived class. See the sample code below:

The member function invoked depends on the runtime type of the object being referenced by the pointer. Note this polymorphic behavior only applies to pointers and references.

sandeep kokane
Greenhorn

Joined: Nov 29, 2000
Posts: 19

posted Jul 11, 2002 22:04:00

0

Thanks A Lot all of u. Actually i know that there is not "virtual" keyword in the JAVA. But the question about is asked me in the JAVA technical interview. So i was confuse that time. Thanks A lot again .