Answer:
The method definition to this question can be described as follows:
Method definition:
BirthMonthDay SetBirth(int monthVal, int dayVal) //defining method SetBirth
{
BirthMonthDay type; //defining structure type variable
type.month = monthVal; //holding value
type.day = dayVal;//holding value
return type; //retrun value
}
Step-by-step explanation:
Definition of the method can be described as follows:
- In the above method definition a structure type method "SetBirth" is defined, that accepts two integer parameter, that is "monthVal and dayVal". This method uses typedef for declaring the structure type method.
- Inside the method, a structure type variable that is "type" is declared, which holds the method parameter value and uses the return keyword to return its value.