Skip to content
Prev 3867 / 12125 Next

[R-pkg-devel] Function Overloading of S4 Methods

Good day,

Some programming languages, such as C++, allow function overloading. Is it possible to mimic it when creating S4 methods?

An example from an undergraduate text book is:

int largerInt(int x, int y);
char largerChar(char first, char second);

You can write the previous function prototypes simply as

int larger(int x, int y);
char larger(char first, char second);

Conversely, it does not seen to be possible to use different formal argument names for a S4 generic, unless I don't know about some obscure trick to do it.

--------------------------------------
Dario Strbenac
University of Sydney
Camperdown NSW 2050
Australia