Maha EL-basuonyOOP
 Agenda
 Arraya data structure that contains several variables of the same type. One Dimensional ArrayType  [ ] Array_Name = new int [arraySize]; Examplesint[] myIntArray = {5, 9, 10, 2, 99}; int[] myIntArray = new int[5]; int[] myIntArray = new int[5] {5, 9, 10, 2, 99};
 Multidimensional Arrays  -A two - dimensional array such as this is declared as follows:  <  baseType  > [ , ]  <  name  >  Examplesdouble[ , ] hillHeight = new double[3,4]; int[ , ] hillHeight = {{1, 2, 3, 4}, {2, 3, 4, 5}, {3, 4, 5, 6}};
 Arrays of Arraysint[][] MyArray; MyArray = {{1, 2, 3}, {1}, {1, 2}}; int[][] MyArray = {new int[] {1, 2, 3}, new int[] {1}, new int[]{1,2}}; MyArray = new int[2][];MyArray[0] = new int[3];MyArray[1] = new int[4]; MyArray= new int[3][] {new int[] {1, 2, 3}, new int[] {1},new int[] {1, 2}};
String Manipulation
String Builder
Array List
Queue
Functionsstatic  Void <  functionName  >  ( ){   ... } static  <  returnType  >     <  functionName  >  ( ) {   ...   return  <  returnValue  > }
Value Parameters
 Reference Parameters
 Out Parameters
Main Function static void Main( )static void Main(string[] args)static int Main()static StringMain(string[] args)
Struct Function
 Overloading Functions  create multiple functions with the same name, but each working with different parameter types
Generic
 Delegates A delegate  is a type that enables you to store references to functions.
 try   . . .   catch . . . finally try   {       //the code that might has exception   }   catch   {       //exception handling block    }  finally  {       //this block is executed either there           is exceptions or not  }
Classes & Objects
Constructors
This
Access Modifier-Public     Members are accessible from any code.-Private   Members are accessible only from code that is part of the class (the default if no keyword is used).  -Protected   Members are accessible only from code that is part of either the class or a derived class.-Internal    Members are accessible only from code within the project (assembly) where they are defined.  -Protected Internal   These are only accessible from code - derived classes within the project (more accurately, the assembly).
Class Definition
Encapsulation
Inheritanceis -a
has -a
tire is  a carcar has a tirehas -a
Interface-like a class, but has no implementation.-Can be Internal or Public
Polymorphism
Future Sessions
Q & AThanks

OOP in C#

  • 1.
  • 2.
  • 3.
    Arraya datastructure that contains several variables of the same type. One Dimensional ArrayType [ ] Array_Name = new int [arraySize]; Examplesint[] myIntArray = {5, 9, 10, 2, 99}; int[] myIntArray = new int[5]; int[] myIntArray = new int[5] {5, 9, 10, 2, 99};
  • 5.
    Multidimensional Arrays -A two - dimensional array such as this is declared as follows: < baseType > [ , ] < name > Examplesdouble[ , ] hillHeight = new double[3,4]; int[ , ] hillHeight = {{1, 2, 3, 4}, {2, 3, 4, 5}, {3, 4, 5, 6}};
  • 7.
    Arrays ofArraysint[][] MyArray; MyArray = {{1, 2, 3}, {1}, {1, 2}}; int[][] MyArray = {new int[] {1, 2, 3}, new int[] {1}, new int[]{1,2}}; MyArray = new int[2][];MyArray[0] = new int[3];MyArray[1] = new int[4]; MyArray= new int[3][] {new int[] {1, 2, 3}, new int[] {1},new int[] {1, 2}};
  • 9.
  • 10.
  • 11.
  • 12.
  • 14.
    Functionsstatic Void< functionName > ( ){ ... } static < returnType > < functionName > ( ) { ... return < returnValue > }
  • 18.
  • 19.
  • 20.
  • 21.
    Main Function staticvoid Main( )static void Main(string[] args)static int Main()static StringMain(string[] args)
  • 24.
  • 25.
    Overloading Functions create multiple functions with the same name, but each working with different parameter types
  • 26.
  • 27.
    Delegates Adelegate is a type that enables you to store references to functions.
  • 29.
    try . . . catch . . . finally try { //the code that might has exception } catch { //exception handling block } finally { //this block is executed either there is exceptions or not }
  • 31.
  • 32.
  • 33.
  • 34.
    Access Modifier-Public Members are accessible from any code.-Private Members are accessible only from code that is part of the class (the default if no keyword is used). -Protected Members are accessible only from code that is part of either the class or a derived class.-Internal Members are accessible only from code within the project (assembly) where they are defined. -Protected Internal These are only accessible from code - derived classes within the project (more accurately, the assembly).
  • 35.
  • 39.
  • 41.
  • 42.
  • 43.
    tire is a carcar has a tirehas -a
  • 46.
    Interface-like a class,but has no implementation.-Can be Internal or Public
  • 50.
  • 51.
  • 52.