Exemple #1
0
        private void btnShow_Click(object sender, EventArgs e)
        {
            // Uses Age property defined in the Person class
            aStudent.Age = 25;

            // Calls overridden ToString() in Person
            // Returns the first name, a space, and the last name
            txtBxName.Text = aStudent.ToString();

            // Calls ToString( ) from Object
            // Returns a number representing age in string format
            txtBxAge.Text = aStudent.Age.ToString();

            // Uses StudentID property defined in Student class
            txtBxID.Text = aStudent.StudentId;

            // Calls GetSleepAmt( ) defined in Student class
            txtBxStudentSleep.Text =
                Convert.ToString(aStudent.GetSleepAmt());

            // Calls method defined in Student class that
            // has a call to base.GetSleepAmt( ) in Person class
            txtBxPersonSleep.Text =
                Convert.ToString(aStudent.CallOverriddenGetSleepAmt());

            // GetExerciseHabits( ) method defined as abstract method in Person
            txtBxExercise.Text = aStudent.GetExerciseHabits();
            btnTravel.Visible  = true;
        }
Exemple #2
0
 private void btnShow_Click(object sender, EventArgs e)
 {
     aStudent.Age            = 25;
     txtBoxName.Text         = aStudent.ToString();
     txtBoxAge.Text          = aStudent.Age.ToString();
     txtBoxStudentId.Text    = System.Convert.ToString(aStudent.StudentId);
     txtBoxSleepAmnt.Text    = System.Convert.ToString(aStudent.GetSleepAmt());
     txtBoxSleepForMost.Text = System.Convert.ToString(aStudent.CallOverriddenGetSleepAmt());
 }
Exemple #3
0
        private void btnShow_Click(object sender, EventArgs e)
        {
            // Uses Age property defined in the Person class
            aStudent.Age = 25;

            // Calls overridden ToString() defined in Person class
            txtBxName.Text = aStudent.ToString();

            // Calls ToString( ) defined in object class
            txtBxAge.Text = aStudent.Age.ToString();

            // Uses StudentID property defined in Student class
            txtBxID.Text = aStudent.StudentId;

            // Calls GetSleepAmt( ) defined in Student class
            txtBxStudentSleep.Text = Convert.ToString(aStudent.GetSleepAmt());

            // Calls method defined in Student class that
            // has a call to base.GetSleepAmt( ) in Person class
            txtBxPersonSleep.Text = Convert.ToString(aStudent.CallOverriddenGetSleepAmt());
        }