Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by nZemekis ( 16 years ago )
//////////////////////////
class Timer1
{
  int getTimer() { return TIM1_CNT;}
  
};

/*
тут много классов Timer2, 3 etc.
*/


template <class T>
struct Timer 
{
  int get_timer{ return T.getTimer(); }
  }
};
////////////////////////
где-то в коде
Timer<Timer1> timer;
timer.get_timer(); // и будет вызвана только ф-ция get_timer, вызывающая getTimer у класса нужного типа.

 

Revise this Paste

Children: 14574
Your Name: Code Language: