Showing posts with label Procedure. Show all posts
Showing posts with label Procedure. Show all posts
Thursday, May 10, 2012
Getters & setters
"Mutator method - Wikipedia, the free encyclopedia" ( http://bit.ly/K3zSdR )
Tuesday, March 27, 2012
Methods: Procedures & Functions
DOWNLOAD THE CODE: MethodsPkg
There are two types of methods:
A method signature is a contract which specifies:
Procedure
What it does: executes processing statements.
Example:
Function
What it does: executes processing statements and returns a value to the calling procedure.
Example:
There are two types of methods:
- Procedure
- Function
A method signature is a contract which specifies:
- visibility (can it be seen externally?)
- what type of data it will return
- what it will do (the name)
- which data, if any, it requires to perform it's task
visibility | return data type | method name | (parameters if any) {
}
Procedure
What it does: executes processing statements.
Example:
The method signature for a procedure always contains the keyword void (meaning nothing/empty). This is as opposed to a function, which always returns a value. Read on...
Function
What it does: executes processing statements and returns a value to the calling procedure.
Example:
The method signature for a function always contains a datatype to indicate the type of data that will be returned from the function.
The final statement in a function begins with the return keyword, followed by the data that will be returned. In this case, a String.
Methods may also require incoming values called parameters (sometimes called arguments) which are placed within the parenthesis following the method name.
Subscribe to:
Posts (Atom)

