Top "Virtual-functions" questions

In object-oriented programming, a virtual function or virtual method is a function or method whose behaviour can be overridden within an inheriting class by a function with the same signature.

What is the difference between an abstract function and a virtual function?

What is the difference between an abstract function and a virtual function? In which cases is it recommended to use …

oop language-agnostic abstract virtual-functions
Why do we need virtual functions in C++?

I'm learning C++ and I'm just getting into virtual functions. From what I've read (in the book and online), virtual …

c++ virtual-functions
Can I call a base class's virtual function if I'm overriding it?

Say I have classes Foo and Bar set up like this: class Foo { public: int x; virtual void printStuff() { std::…

c++ virtual-functions overriding
Can you write virtual functions / methods in Java?

Is it possible to write virtual methods in Java, as one would do in C++? Or, is there a proper …

java virtual virtual-functions
Can a class member function template be virtual?

I have heard that C++ class member function templates can't be virtual. Is this true? If they can be virtual, …

c++ templates virtual-functions function-templates c++-faq
Virtual member call in a constructor

I'm getting a warning from ReSharper about a call to a virtual member from my objects constructor. Why would this …

c# constructor warnings resharper virtual-functions
Safely override C++ virtual functions

I have a base class with a virtual function and I want to override that function in a derived class. …

c++ overriding virtual-functions
Calling virtual functions inside constructors

Suppose I have two C++ classes: class A { public: A() { fn(); } virtual void fn() { _n = 1; } int getn() { return _n; } protected: …

c++ constructor overriding virtual-functions
Why use virtual functions?

Possible Duplicate: Can someone explain C++ Virtual Methods? I have a question regarding to the C++ virtual functions. Why and …

c++ virtual-functions