|WikiProject Computing||(Rated Start-class)|
I think this article needs a section on Default Virtual Methods.
This would qualify the fact that the child has a option of -
 Override with its own virtual method (polymorph)  use Default Virtual Method (in the parent)  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!
This article indicates that these ideas are generally part of Object Oriented Programming, but they're not. There are plenty of Object Oriented Programming languages where the semantics of "virtual" or "pure virtual" methods are arrived at by very different means. Jfm3 (talk) 06:12, 18 July 2008 (UTC)
- there should be mention that in Java all methods are virtual by default - dddd (talk) 18:50, 26 June 2014 (UTC)
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.
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)
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)
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")
Why is this concept called virtual? --Abdull 14:09, 4 April 2007 (UTC)
Output for undefined
If the behavior of an action is undefined, it simply does not make any sense to present Output here.
What that output represent is how some implementation of a c++ compiler handles the situation.
By not even mentioning what compiler was used, showing the output becomes both pointless but also dangerous (it is *not* safe to assume that the output is what one's going to see everytime everwhere).
C# abstract methods
This article needs some mention of the (bizarre in my view) requirement for implementations of abstract methods in derived classes to specify the override keyword. Needs somebody who knows C# inside out and I don't qualify!
I wouldn't declare the destructors as virtual in the C++ example. It's just confusing.
- OK, I see that it is recommended to declare destructors as virtual in general. But I still think it may be more appropriate to leave the virtual out in the first example.
The sentence: "In the example below having no virtual destructor, while deleting an instance of class B will correctly call destructors for both B and A if the object is deleted as an instance of B, an instance of B deleted via a pointer to its base class A will produce undefined behaviour." is a bit long and at least for me (not a native english speaker) the meaning of this sentence is left unclear. Please someone consider reading it and making it clearer. Thank you. 18.104.22.168 (talk) 17:10, 11 April 2011 (UTC)
Why such a complex example to illustrate the wrong usage of virtual method ?
In one of the example programs, a static nested class has been used to illustrate the wrong usage of virtual functions in the constructor. A simpler example would have done. — Preceding unsigned comment added by Arpit.gupta85 (talk • contribs) 07:39, 20 December 2011 (UTC)