microsoft tech club cairo university "mstc'16 builders and developers " third session

Post on 23-Jan-2017

384 Views

Category:

Mobile

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Introduction to C#

Session #3

Prepared and Presented byAya Zakaria Wagdy Mohamed

Microsoft

Agenda

• Arrays

• Functions

• Introduction to OOP

Arrays

Arrays

1D/2D

Static Dynamic

Static Array

Dynamic Array

1D and 2D array

int [ ] 1D= new int [4];

int [ , ] 2D= new int [3,3];

4 3 2 1

0 1 2 3

3 2 1

6 5 4

9 8 7

0

1

2

0 1 2

Elements

Index

Task Code

Functions

• Header

• Body

Function Header

• Access specifier

• Return type

• Function name

• Parameters

Access specifier

• This determines the visibility of a variable or a function from another class.

Public Private

Return type

• A function may return a value. The return type is the data type of the value the function returns. If the function is not returning any values, then the return type is void.

Function name

• Function name is a unique identifier and it is case sensitive. It cannot be same as any other identifier declared in the class.

Parameters

• Parameters are used to pass and receive data from a method

Function body

Introduction to OOP

• Class

• Object

• Setters and Getters

• Constructors

Class

Class: is a set of instructions to build a specific type of data

Object

Object: is keyword or component that contains properties and functions of class

Setters and Getters

Constructor

• Constructors: technique helps you to assign initial value to an object at the time of its creation and there are two types of constructors.

Default Constructor

• Default constructor: does not have any parameter

Implementation

Calling in main

Parameterized Constructor

Implementation

Calling in main

• Parameterized constructor: have parameters

Creating Class Car

Creating object from class Car

wagdy.mohamed.95

wagdy.mohamed@outlook.sa

yoya.zakaria

ayazakaria@outlook.com

Contacts

top related