A
ajay.somni
I would like to know what is virtual function in c++.
Besides what is virtual.
Besides what is virtual.
I would like to know what is virtual function in c++.
Besides what is virtual.
[email protected] said:I would like to know what is virtual function in c++.
Besides what is virtual.
I would like to know what is virtual function in C++.
Besides what is virtual.
#include <iostream>cat main.cpp
Base::f(void)g++ -Wall -ansi -pedantic -o main main.cpp
./main
Rapscallion said:The same as in Java.
I would like to know what is virtual function in c++.
Besides what is virtual.
Gregory L. Hansen said:A virtual member function in a base class is overridden by a member
function of the same name in a derived class.
Victor said:There are some small yet very important differences.
Andrew said:eh?
What differences?
Aside from all methods are virtual in Java by default.
Java methods can be made non-virtual by appending the 'final' keyword to
them as in:
public final void someMethod() {
}
Howard said:There's a bit more to the subject than that, isn't there?
And, it doesn't *have* to be overridden...ever. You can make a function
virtual just *in case* you want to override it later.
-Howard
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.