0% found this document useful (0 votes)
32 views

Object Oriented Programming: By: Irfan U. Memon

This document outlines key concepts in object-oriented programming including reference variables, parametrized methods, value and reference parameters, and the heap and stack. It discusses how value types store data directly while reference types store references to data. It also covers how methods manipulate class data, the syntax for defining methods, and how parameters allow passing values to methods.

Uploaded by

Irfan Memon
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Object Oriented Programming: By: Irfan U. Memon

This document outlines key concepts in object-oriented programming including reference variables, parametrized methods, value and reference parameters, and the heap and stack. It discusses how value types store data directly while reference types store references to data. It also covers how methods manipulate class data, the syntax for defining methods, and how parameters allow passing values to methods.

Uploaded by

Irfan Memon
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Object Oriented

Programming
BY: IRFAN U. MEMON
B.E (SOFTWARE ENGINEERING)
MEHRAN UET. JAMSHORO

Outlines
Reference Variables
Parametrized Methods.
Value Parameters
Reference Parameter

Heap and Stack

Data Types: Value Types and


Reference Types
Value Types
variables of value types directly contain their data.
All intrinsic data types ( int, long, float etc)
What happens when we assign one variable to an other.

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.

Building house1 = new Building();


Building house2 = house1;

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
}

Return from a method.


There are two conditions that cause a method to return
When the methods closing curly brace is encountered
When a return statement is executed

There are two forms of return


One for use in void methods (those that do not return a value)
One for returning values

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

Parameters are declared inside the parentheses.

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.

You might also like