Solutions
Save
Terms in this set (138)
Methods can be used to break a complex program into small
manageable pieces
divide and conquer process of breaking down a complex program into
small manageable pieces
modularization breaking down a program into smaller units of code
such as methods
void, value returning two types of methods
void method simply executes a group of statements then
terminates
value-returning method method returns a value to the statement that called it
,using a long sequence of statements Namespace Example
to perform a task {
public partial class Form1 : Form
{
private void myButton_Click(object sender,
EventArgs e)
{
statement;
statement;
statement;
statement;
statement;
statement;
...
}
}
}
using methods to divide and conquer Namespace Example
a problem {
public partial class Form1 : Form
{
private void myButton_Click(object sender,
EventArgs e)
{
Method2();
Method3();
...
}
private void Method2();
{
statements;
}
private void Method3();
{
statements;
}
}
}
write its definitions in two parts how to create a method
, header and body 2 parts of a method
header part of a method that appears at the beginning of a
method definition to indicate access mode, return
type, and method name
body part of a method that is a collections of statements
that are performed when the method is executed
access modifier, return type, method four parts of a method header
name, parentheses
access modifier keywords that define the access control
private access modifier can only be called by code inside the same class as
the method
public access modifier can be called by a code that is outside the class
return type specifies whether or not a method returns a value
method name the identifier of the method, must be unique in a
given program
parantheses always follows a methods name
a method header to display a private void DisplayMessage()
message box {
MessageBox.Show("This is the DisplayMessage
method.");
}
a class a method usually belongs to what
method call statement the name of a method followed by a pair of
parenthesis