English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

its an assignment so if you can send me a 20 line answer it would be helpful to figure out the rest..

2007-02-24 00:26:14 · 3 answers · asked by mama_kusumbu 1 in Computers & Internet Programming & Design

3 answers

In C++ you can mark a method to be virtual", which tells the compiler that you will want to use the most derived method in the object hierarchy.
In Java, on the other hand, ALL methods are virtual, i.e. the most derived method is always called.
A Virtual method on C++ works like this - If you have a class A with method f() and a subclass B with the method f(), and you call the method f() on a handle of A pointing to a B, then B's f() gets called. If you left out the "virtual" keyword, it would cause A's f() to get called, i.e. it is bound at compile time, rather than runtime.

--
Ck
http://www.gfour.net

2007-02-24 00:56:24 · answer #1 · answered by KingPin 3 · 0 0

This one I am not real sure on, but I know that it has what is called virtual machine. So, I think that it does. You need it in order to play certain flash games, like the ones found at www.freeslots.com There is no spyware or adware on the site, so you can check it out. Norton antivirus and Adware SE do not pick up the use of that site.

2007-02-24 00:33:12 · answer #2 · answered by Mike Larson 2 · 0 1

In Java we can achieve the virtual function by the method dynamic dispatching

ex:
Base b=new Derive();
b.method();//calling derived class method
b=new Base();
b.method();//calling base class method

2007-02-24 00:46:27 · answer #3 · answered by sridhar b 2 · 0 0

fedest.com, questions and answers