• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
4th june
 

4th june

on

  • 1,150 views

 

Statistics

Views

Total Views
1,150
Views on SlideShare
977
Embed Views
173

Actions

Likes
0
Downloads
22
Comments
0

1 Embed 173

http://yehtechnologies.com 173

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    4th june 4th june Presentation Transcript

    • NAMESPACES&CLASSES
      4thJune 2010
    • NESTED NAMESPACES
      using System;namespaceOutNamespace{
      namespaceWorkNamespace {
      /// can be placed some classes, structures etc. }
      }
    • CLASSES
      class TestClass
      {
      // Methods, properties, fields, events, delegates
      // and nested classes go here.
      }
    • CLASS INHERITANCE
    • Classes
      // Namespace Declarationusing System;// helper classclass OutputClass {    string myString;    // Constructor    public OutputClass(string inputString)     {        myString = inputString;    }    // Instance Method    public void printString()     {        Console.WriteLine("{0}", myString);    }    // Destructor    ~OutputClass()     {        // Some resource cleanup routines    }}
      // Program start classclass ExampleClass {    // Main begins program execution.    public static void Main()     {        // Instance of OutputClass        OutputClassoutCl = new OutputClass("This is printed by the output class.");        // Call Output class' method        outCl.printString();     }}
    • INHERITANCE EXAMPLE
      using System;public class ParentClass{    public ParentClass()    {        Console.WriteLine("Parent Constructor.");    }    public void print()    {        Console.WriteLine("I'm a Parent Class.");    }}public class ChildClass : ParentClass{    public ChildClass()    {        Console.WriteLine("Child Constructor.");    }    public static void Main()    {        ChildClass child = new ChildClass();        child.print();    }}
    • EXAMPLE 2
      using System;
       
      public class Parent
      {
          string parentString;
          public Parent()
          {
              Console.WriteLine("Parent Constructor.");
          }
          public Parent(string myString)
          {
              parentString = myString;
              Console.WriteLine(parentString);
          }
          public void print()
          {
              Console.WriteLine("I'm a Parent Class.");
          }
      }
       
      public class Child : Parent
      {
          public Child() : base("From Derived")
          {
              Console.WriteLine("Child Constructor.");
          }
          public new void print()
          {
              base.print();
              Console.WriteLine("I'm a Child Class.");
          }
          public static void Main()
          {
              Child child = new Child();
              child.print();
              ((Parent)child).print();
          }
      }
    • Types of Statements in C#
      the if statement
      switch statement
      the for loop
      the while loop
      the do…while loop
      the foreachloop