Pure virtual method - Your Art History Reference Guide!

ArtHistoryClub Information Site on Pure virtual method Art History Art History Search        Art History Browse welcome to our free resource site for all art history lovers!
Art History Search        Art History Browse             News        Gallery        Forums        Articles        Weblinks        welcome to our free resource site for all art history lovers!

Pure virtual method

In object oriented programming, a pure virtual method is a virtual method which has a declaration (a signature), but no definition (implementation). This may be used where it does not make sense to provide a default implementation of a method.

In C++, pure virtual methods only make sense (and are only legal) in an inheritance tree . Classes which have one or more pure virtual methods cannot be instantiated. This is because the compiler would not have any code to execute if the user of the class tried to call a pure virtual method. Thus, in C++, pure virtual methods force deriving classes to implement a piece of functionality to fulfil the pure virtual method.

A real world example may be a class of type account. The designer may decide it to be undesirable to provide a default implementation of a 'Calculate Interest' method, instead leaving the actual implementation to the designers of the derived classes 'Current Account' and 'Savings Account'.

Last updated: 08-01-2005 14:44:12
Last updated: 06-05-2009 13:38:31
The contents of this article are licensed from Wikipedia.org under the
GNU Free Documentation License. See original document.

See more unique gifts by PositiveDesigns
Art History Search | Art History Browse | Contact | Legal info