} // define S_DozensCount as a int counter. public S_Dozens(P_Incrementer p_incrementer) // construct function and define a instance method { Sp_DozensCount = 0; // define and init // RECEIVE the EVENT : P_evt_CountedADozen and revoke the counter! p_incrementer.P_evt_CountedADozen += S_IncrementDozensCount; }
static void Main(string[] args) { P_Incrementer p_incrementer = new P_Incrementer(); S_Dozens s_dozensCount = new S_Dozens(p_incrementer); p_incrementer.P_m_DoCount(); Console.WriteLine("Number of dozens = {0}", s_dozensCount.Sp_DozensCount); }