| Author |
help with Virtual methods!!
|
Ammar Salem
Ranch Hand
Joined: Dec 29, 2007
Posts: 60
|
|
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
|
****************************<br />For Some Dreams.....<br />One Lifetime Is Not Enough.<br />****************************
|
 |
Daesung Park
Ranch Hand
Joined: Mar 22, 2007
Posts: 68
|
|
|
I haven't heard of "virtual" method in Java. Do you mean that of C++, or abstract method of Java?
|
Daesung Park
BLOG
|
 |
Ammar Salem
Ranch Hand
Joined: Dec 29, 2007
Posts: 60
|
|
No Daesung Park , it is in my java book. and i dont know what to do with it regards,
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16695
|
|
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
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Ammar Salem
Ranch Hand
Joined: Dec 29, 2007
Posts: 60
|
|
thanks to all of you respect, Ammar
|
 |
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
|
|
|
With other words, virtual methods are methods that behave polymorphically. See also http://en.wikipedia.org/wiki/Virtual_function
|
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
|
 |
Ammar Salem
Ranch Hand
Joined: Dec 29, 2007
Posts: 60
|
|
thank you ,Ranchers
|
 |
Ammar Salem
Ranch Hand
Joined: Dec 29, 2007
Posts: 60
|
|
thank you,Ranchers Regards Ammar [ January 23, 2008: Message edited by: Ammar Salem ]
|
 |
 |
|
|
subject: help with Virtual methods!!
|
|
|