コード例 #1
0
        public static void Main_Cricket_V1(String [] args)
        {
            // Create objects for testing
            AverageScoreDisplay averageScoreDisplay =
                new AverageScoreDisplay();
            CurrentScoreDisplay currentScoreDisplay =
                new CurrentScoreDisplay();

            // Pass the displays to Cricket data
            CricketData cricketData = new CricketData(currentScoreDisplay,
                                                      averageScoreDisplay);

            // In real app you would have some logic to call this
            // function when data changes
            cricketData.dataChanged();

            Console.ReadKey();
        }
コード例 #2
0
 // Constructor
 public CricketData(CurrentScoreDisplay currentScoreDisplay,
                    AverageScoreDisplay averageScoreDisplay)
 {
     this.currentScoreDisplay = currentScoreDisplay;
     this.averageScoreDisplay = averageScoreDisplay;
 }