Programming ideas

Материал из fidoman.ru

Function classes

Taking function as argument obviously requires that function have defined argument list and return value type - but nothing is said about what the function will do.

Assigning function some class may provide tool for programmer to specify, what function can be used as argument.

E.g. we want have to put on queue only functions that have meaning in this queue (different variants of uart send functions). So we require function that have class of "uart send queue". So if programmer creates functions that works in this context, he would mark it with this class "uart send queue". No other functions can be given here is result, even they have identical attribute list - but is nonsence if called here.