public void DecreaseHealth(int factor) { if (!_incarnation1.IsNeutralized) { _incarnation1.DecreaseHealth(factor); } else { _incarnation2.DecreaseHealth(factor); } }
// Builds virtual method. // Takes one parameter. public void DecreaseHealth(int factor) { // Builds if statement. if (!_incarnation1.IsNeutralized) { // Method call // using object name. // Takes one parameter. _incarnation1.DecreaseHealth(factor); } else { // Method call // using object name. // Takes one parameter. _incarnation2.DecreaseHealth(factor); } }