SlideShare una empresa de Scribd logo
1 de 8
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

Más contenido relacionado

Similar a 4th june

Class loader basic
Class loader basicClass loader basic
Class loader basic
명철 강
 
Define a class named Doctor whose objects are records for clinic’s d.pdf
Define a class named Doctor whose objects are records for clinic’s d.pdfDefine a class named Doctor whose objects are records for clinic’s d.pdf
Define a class named Doctor whose objects are records for clinic’s d.pdf
MALASADHNANI
 
Programming in C#Define an application to include classes for Stud.pdf
Programming in C#Define an application to include classes for Stud.pdfProgramming in C#Define an application to include classes for Stud.pdf
Programming in C#Define an application to include classes for Stud.pdf
fashionscollect
 

Similar a 4th june (20)

Class loader basic
Class loader basicClass loader basic
Class loader basic
 
3 j unit
3 j unit3 j unit
3 j unit
 
Core Java
Core JavaCore Java
Core Java
 
Core java concepts
Core java concepts Core java concepts
Core java concepts
 
Test Program - Basic operators
Test Program - Basic operatorsTest Program - Basic operators
Test Program - Basic operators
 
Test program
Test programTest program
Test program
 
J Unit
J UnitJ Unit
J Unit
 
srgoc
srgocsrgoc
srgoc
 
JUnit 5
JUnit 5JUnit 5
JUnit 5
 
Define a class named Doctor whose objects are records for clinic’s d.pdf
Define a class named Doctor whose objects are records for clinic’s d.pdfDefine a class named Doctor whose objects are records for clinic’s d.pdf
Define a class named Doctor whose objects are records for clinic’s d.pdf
 
Java Concepts
Java ConceptsJava Concepts
Java Concepts
 
Unit-3 Practice Programs-5.docx
Unit-3 Practice Programs-5.docxUnit-3 Practice Programs-5.docx
Unit-3 Practice Programs-5.docx
 
How to Start Test-Driven Development in Legacy Code
How to Start Test-Driven Development in Legacy CodeHow to Start Test-Driven Development in Legacy Code
How to Start Test-Driven Development in Legacy Code
 
Introduzione al TDD
Introduzione al TDDIntroduzione al TDD
Introduzione al TDD
 
Java programs
Java programsJava programs
Java programs
 
Inheritance
InheritanceInheritance
Inheritance
 
My java file
My java fileMy java file
My java file
 
Defining classes-and-objects-1.0
Defining classes-and-objects-1.0Defining classes-and-objects-1.0
Defining classes-and-objects-1.0
 
Programming in C#Define an application to include classes for Stud.pdf
Programming in C#Define an application to include classes for Stud.pdfProgramming in C#Define an application to include classes for Stud.pdf
Programming in C#Define an application to include classes for Stud.pdf
 
Java02
Java02Java02
Java02
 

Más de Rahat Khanna a.k.a mAppMechanic

Más de Rahat Khanna a.k.a mAppMechanic (12)

Introduction to React Native & Rendering Charts / Graphs
Introduction to React Native & Rendering Charts / GraphsIntroduction to React Native & Rendering Charts / Graphs
Introduction to React Native & Rendering Charts / Graphs
 
Angular Observables & RxJS Introduction
Angular Observables & RxJS IntroductionAngular Observables & RxJS Introduction
Angular Observables & RxJS Introduction
 
MAppMechanic CodeLabs - PolymerJS Elements - Paper, Gold, Neon, Platinum, Mol...
MAppMechanic CodeLabs - PolymerJS Elements - Paper, Gold, Neon, Platinum, Mol...MAppMechanic CodeLabs - PolymerJS Elements - Paper, Gold, Neon, Platinum, Mol...
MAppMechanic CodeLabs - PolymerJS Elements - Paper, Gold, Neon, Platinum, Mol...
 
MAppMechanic CodeLabs - PolymerJS Advanced Topics for Custom Elements
MAppMechanic CodeLabs - PolymerJS Advanced Topics for Custom ElementsMAppMechanic CodeLabs - PolymerJS Advanced Topics for Custom Elements
MAppMechanic CodeLabs - PolymerJS Advanced Topics for Custom Elements
 
MAppMechanic CodeLabs - PolymerJS Custom Elements
MAppMechanic CodeLabs - PolymerJS Custom ElementsMAppMechanic CodeLabs - PolymerJS Custom Elements
MAppMechanic CodeLabs - PolymerJS Custom Elements
 
MAppMechanic CodeLabs - PolymerJS Introduction
MAppMechanic CodeLabs - PolymerJS IntroductionMAppMechanic CodeLabs - PolymerJS Introduction
MAppMechanic CodeLabs - PolymerJS Introduction
 
New World of Angular (v2+)
New World of Angular (v2+)New World of Angular (v2+)
New World of Angular (v2+)
 
15th june
15th june15th june
15th june
 
13th june
13th june13th june
13th june
 
9th june
9th june9th june
9th june
 
7th june
7th june7th june
7th june
 
2nd june
2nd june 2nd june
2nd june
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 

Último (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 

4th june

  • 2. NESTED NAMESPACES using System;namespaceOutNamespace{ namespaceWorkNamespace { /// can be placed some classes, structures etc. } }
  • 3. CLASSES class TestClass { // Methods, properties, fields, events, delegates // and nested classes go here. }
  • 5. 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();     }}
  • 6. 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();    }}
  • 7. 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();     } }
  • 8. Types of Statements in C# the if statement switch statement the for loop the while loop the do…while loop the foreachloop