Talk:Virtual function

From Wikipedia, the free encyclopedia

I think this article needs a section on Default Virtual Methods.

This would qualify the fact that the child has a option of -

[1] Override with its own virtual method (polymorph) [2] use Default Virtual Method (in the parent) [3] Override and also use the parents default method

This section should also state one or two languages that support this.

Shawnk Fri 06/23/2006

This article has a very poor definition of virtual function, and a completely incorrect one of pure virtual function. You'd fail my interview!

Contents

[edit] Bad definition

I do not belive that this is the correct defenition and in any case, the example is that of polymorphism and does nothing in the way of explaining what does the use of the keyword virtual help.

[edit] Definition Fix

I made an attempt at correcting the definition. I believe that it is now correct (if not complete).

Andy 16:10, 28 September 2006 (UTC)

[edit] Example Fix

Even though it's not relevant to the topic discussed I think Wikipedia examples should not include code with such obvious memory leaks (four instances of Animal are allocated but never released). I'll fix this. --Liss 16:29, 5 December 2006 (UTC)

[edit] Error: C++/pure virtual functions

In c++, pure virtual functions may have definitions. So I think this article is wrong there. (e.g. "http://www.gotw.ca/gotw/031.htm")

[edit] Why virtual

Why is this concept called virtual? --Abdull 14:09, 4 April 2007 (UTC)