Читать книгу The Big R-Book - Philippe J. S. De Brouwer - Страница 196
Note – Distinguish groups and functions
ОглавлениеMath
, Ops
, Summary
, and Complex
aren't functions themselves, but instead represent groups of functions. Also note that inside a group generic function a special variable .Generic
provides the actual generic function that is called.
If you have complex class hierarchies, it is sometimes useful to call the parent method. This parent method is the method that would have been called if the object-specific one does not exist. For example, if the object is savings_account
, which is a child of account
then calling the function with savings_account
will return the method associated to account
if there is no specific method and it will call the specific method if it exists.