Object Oriented Programming: By: Irfan U. Memon
Object Oriented Programming: By: Irfan U. Memon
Programming
BY: IRFAN U. MEMON
B.E (SOFTWARE ENGINEERING)
MEHRAN UET. JAMSHORO
Outlines
Reference Variables
Parametrized Methods.
Value Parameters
Reference Parameter
Reference Types
Variables of reference types store references to their data.
variables can reference the same object.
Reference variables act differently than do variables of a value type
Operations on one variable can affect the object referenced by the other variable
Keywords to declare reference type:
class, interface, delegate.
Methods.
Methods are subroutines that manipulate the data defined by the class.
provide access to that data
Different parts of the program interacts with class through it methods.
well-written C# code, each method performs only one task.
Syntax of Method.
access-modifier ret-type name(parameter-list) {
// body of method
}
Using parameters
It is possible to pass one or more values to a method when the method is called.
A value passed to a method is called an argument.
the variable that receives the argument is called a formal parameter
The parameter declaration syntax is the same as that used for variables
The scope of a parameter is the body of its method.
acts like any other local variable besides its special task.