Content deleted Content added
m intro |
TheoClarke (talk | contribs) copy edit |
||
Line 1:
In [[
In [[C Plus Plus|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'.▼
{{compu-stub}}
[[Category: Object-oriented programming]]
▲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'.
|