<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FClass_Interface%2FConstructor</id>
		<title>Csharp/C Sharp/Class Interface/Constructor - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FClass_Interface%2FConstructor"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Class_Interface/Constructor&amp;action=history"/>
		<updated>2026-04-29T17:48:29Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/Class_Interface/Constructor&amp;diff=602&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Class_Interface/Constructor&amp;diff=602&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:18Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/Class_Interface/Constructor&amp;diff=603&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Class_Interface/Constructor&amp;diff=603&amp;oldid=prev"/>
				<updated>2010-05-26T11:39:05Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Add a constructor to Building==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C#: The Complete Reference &lt;br /&gt;
by Herbert Schildt &lt;br /&gt;
Publisher: Osborne/McGraw-Hill (March 8, 2002)&lt;br /&gt;
ISBN: 0072134852&lt;br /&gt;
*/&lt;br /&gt;
// Add a constructor to Building. &lt;br /&gt;
  &lt;br /&gt;
using System;  &lt;br /&gt;
  &lt;br /&gt;
class Building {   &lt;br /&gt;
  public int floors;    // number of floors &lt;br /&gt;
  public int area;      // total square footage of building &lt;br /&gt;
  public int occupants; // number of occupants &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
  public Building(int f, int a, int o) { &lt;br /&gt;
    floors = f; &lt;br /&gt;
    area = a; &lt;br /&gt;
    occupants = o; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  // Display the area per person.  &lt;br /&gt;
  public int areaPerPerson() {  &lt;br /&gt;
    return area / occupants; &lt;br /&gt;
  }  &lt;br /&gt;
 &lt;br /&gt;
  /* Return the maximum number of occupants if each &lt;br /&gt;
     is to have at least the specified minum area. */ &lt;br /&gt;
  public int maxOccupant(int minArea) { &lt;br /&gt;
    return area / minArea; &lt;br /&gt;
  } &lt;br /&gt;
}   &lt;br /&gt;
   &lt;br /&gt;
// Use the parameterized Building constructor. &lt;br /&gt;
public class BuildingDemo21 {   &lt;br /&gt;
  public static void Main() {   &lt;br /&gt;
    Building house = new Building(2, 2500, 4);   &lt;br /&gt;
    Building office = new Building(3, 4200, 25); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(&amp;quot;Maximum occupants for house if each has &amp;quot; + &lt;br /&gt;
                      300 + &amp;quot; square feet: &amp;quot; + &lt;br /&gt;
                      house.maxOccupant(300)); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(&amp;quot;Maximum occupants for office if each has &amp;quot; + &lt;br /&gt;
                      300 + &amp;quot; square feet: &amp;quot; + &lt;br /&gt;
                      office.maxOccupant(300)); &lt;br /&gt;
  }   &lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Add a constructor to Triangle==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C#: The Complete Reference &lt;br /&gt;
by Herbert Schildt &lt;br /&gt;
Publisher: Osborne/McGraw-Hill (March 8, 2002)&lt;br /&gt;
ISBN: 0072134852&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// Add a constructor to Triangle. &lt;br /&gt;
 &lt;br /&gt;
using System; &lt;br /&gt;
 &lt;br /&gt;
// A class for two-dimensional objects. &lt;br /&gt;
class TwoDShape { &lt;br /&gt;
  double pri_width;  // private &lt;br /&gt;
  double pri_height; // private  &lt;br /&gt;
 &lt;br /&gt;
  // properties for width and height. &lt;br /&gt;
  public double width { &lt;br /&gt;
     get { return pri_width; } &lt;br /&gt;
     set { pri_width = value; } &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public double height { &lt;br /&gt;
     get { return pri_height; } &lt;br /&gt;
     set { pri_height = value; } &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public void showDim() { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Width and height are &amp;quot; + &lt;br /&gt;
                       width + &amp;quot; and &amp;quot; + height); &lt;br /&gt;
  } &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
// A derived class of TwoDShape for triangles. &lt;br /&gt;
class Triangle : TwoDShape { &lt;br /&gt;
  string style; // private &lt;br /&gt;
   &lt;br /&gt;
  // Constructor &lt;br /&gt;
  public Triangle(string s, double w, double h) { &lt;br /&gt;
    width = w;  // init the base class &lt;br /&gt;
    height = h; // init the base class &lt;br /&gt;
 &lt;br /&gt;
    style = s;  // init the derived class &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  // Return area of triangle. &lt;br /&gt;
  public double area() { &lt;br /&gt;
    return width * height / 2;  &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  // Display a triangle&amp;quot;s style. &lt;br /&gt;
  public void showStyle() { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Triangle is &amp;quot; + style); &lt;br /&gt;
  } &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
public class Shapes3 { &lt;br /&gt;
  public static void Main() { &lt;br /&gt;
    Triangle t1 = new Triangle(&amp;quot;isosceles&amp;quot;, 4.0, 4.0); &lt;br /&gt;
    Triangle t2 = new Triangle(&amp;quot;right&amp;quot;, 8.0, 12.0); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(&amp;quot;Info for t1: &amp;quot;); &lt;br /&gt;
    t1.showStyle(); &lt;br /&gt;
    t1.showDim(); &lt;br /&gt;
    Console.WriteLine(&amp;quot;Area is &amp;quot; + t1.area()); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(&amp;quot;Info for t2: &amp;quot;); &lt;br /&gt;
    t2.showStyle(); &lt;br /&gt;
    t2.showDim(); &lt;br /&gt;
    Console.WriteLine(&amp;quot;Area is &amp;quot; + t2.area()); &lt;br /&gt;
  } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Add constructors to TwoDShape==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C#: The Complete Reference &lt;br /&gt;
by Herbert Schildt &lt;br /&gt;
Publisher: Osborne/McGraw-Hill (March 8, 2002)&lt;br /&gt;
ISBN: 0072134852&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// Add constructors to TwoDShape. &lt;br /&gt;
 &lt;br /&gt;
using System; &lt;br /&gt;
 &lt;br /&gt;
// A class for two-dimensional objects. &lt;br /&gt;
class TwoDShape { &lt;br /&gt;
  double pri_width;  // private &lt;br /&gt;
  double pri_height; // private  &lt;br /&gt;
 &lt;br /&gt;
  // Constructor for TwoDShape. &lt;br /&gt;
  public TwoDShape(double w, double h) { &lt;br /&gt;
    width = w; &lt;br /&gt;
    height = h; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  // properties for width and height. &lt;br /&gt;
  public double width { &lt;br /&gt;
     get { return pri_width; } &lt;br /&gt;
     set { pri_width = value; } &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public double height { &lt;br /&gt;
     get { return pri_height; } &lt;br /&gt;
     set { pri_height = value; } &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public void showDim() { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Width and height are &amp;quot; + &lt;br /&gt;
                       width + &amp;quot; and &amp;quot; + height); &lt;br /&gt;
  } &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
 // A derived class of TwoDShape for triangles. &lt;br /&gt;
class Triangle : TwoDShape { &lt;br /&gt;
  string style; // private &lt;br /&gt;
   &lt;br /&gt;
  // Call the base class constructor. &lt;br /&gt;
  public Triangle(string s, double w, double h) : base(w, h) { &lt;br /&gt;
    style = s;  &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  // Return area of triangle. &lt;br /&gt;
  public double area() { &lt;br /&gt;
    return width * height / 2; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  // Display a triangle&amp;quot;s style. &lt;br /&gt;
  public void showStyle() { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Triangle is &amp;quot; + style); &lt;br /&gt;
  } &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
public class Shapes4 { &lt;br /&gt;
  public static void Main() { &lt;br /&gt;
    Triangle t1 = new Triangle(&amp;quot;isosceles&amp;quot;, 4.0, 4.0); &lt;br /&gt;
    Triangle t2 = new Triangle(&amp;quot;right&amp;quot;, 8.0, 12.0); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(&amp;quot;Info for t1: &amp;quot;); &lt;br /&gt;
    t1.showStyle(); &lt;br /&gt;
    t1.showDim(); &lt;br /&gt;
    Console.WriteLine(&amp;quot;Area is &amp;quot; + t1.area()); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(&amp;quot;Info for t2: &amp;quot;); &lt;br /&gt;
    t2.showStyle(); &lt;br /&gt;
    t2.showDim(); &lt;br /&gt;
    Console.WriteLine(&amp;quot;Area is &amp;quot; + t2.area()); &lt;br /&gt;
  } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Add more constructors to TwoDShape==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C#: The Complete Reference &lt;br /&gt;
by Herbert Schildt &lt;br /&gt;
Publisher: Osborne/McGraw-Hill (March 8, 2002)&lt;br /&gt;
ISBN: 0072134852&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// Add more constructors to TwoDShape. &lt;br /&gt;
 &lt;br /&gt;
using System; &lt;br /&gt;
 &lt;br /&gt;
class TwoDShape { &lt;br /&gt;
  double pri_width;  // private &lt;br /&gt;
  double pri_height; // private  &lt;br /&gt;
 &lt;br /&gt;
  // Default constructor. &lt;br /&gt;
  public TwoDShape() { &lt;br /&gt;
    width = height = 0.0; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  // Constructor for TwoDShape. &lt;br /&gt;
  public TwoDShape(double w, double h) { &lt;br /&gt;
    width = w; &lt;br /&gt;
    height = h; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  // Construct object with equal width and height. &lt;br /&gt;
  public TwoDShape(double x) { &lt;br /&gt;
    width = height = x; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  // Properties for width and height. &lt;br /&gt;
  public double width { &lt;br /&gt;
     get { return pri_width; } &lt;br /&gt;
     set { pri_width = value; } &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public double height { &lt;br /&gt;
     get { return pri_height; } &lt;br /&gt;
     set { pri_height = value; } &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public void showDim() { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Width and height are &amp;quot; + &lt;br /&gt;
                       width + &amp;quot; and &amp;quot; + height); &lt;br /&gt;
  } &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
// A derived class of TwoDShape for triangles. &lt;br /&gt;
class Triangle : TwoDShape { &lt;br /&gt;
  string style; // private &lt;br /&gt;
   &lt;br /&gt;
  /* A default constructor. This automatically invokes &lt;br /&gt;
     the default constructor of TwoDShape. */ &lt;br /&gt;
  public Triangle() { &lt;br /&gt;
    style = &amp;quot;null&amp;quot;; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  // Constructor that takes three arguments. &lt;br /&gt;
  public Triangle(string s, double w, double h) : base(w, h) { &lt;br /&gt;
    style = s;  &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  // Construct an isosceles triangle. &lt;br /&gt;
  public Triangle(double x) : base(x) { &lt;br /&gt;
    style = &amp;quot;isosceles&amp;quot;;  &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  // Return area of triangle. &lt;br /&gt;
  public double area() { &lt;br /&gt;
    return width * height / 2; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  // Display a triangle&amp;quot;s style. &lt;br /&gt;
  public void showStyle() { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Triangle is &amp;quot; + style); &lt;br /&gt;
  } &lt;br /&gt;
} &lt;br /&gt;
 &lt;br /&gt;
public class Shapes5 { &lt;br /&gt;
  public static void Main() { &lt;br /&gt;
    Triangle t1 = new Triangle(); &lt;br /&gt;
    Triangle t2 = new Triangle(&amp;quot;right&amp;quot;, 8.0, 12.0); &lt;br /&gt;
    Triangle t3 = new Triangle(4.0); &lt;br /&gt;
 &lt;br /&gt;
    t1 = t2; &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(&amp;quot;Info for t1: &amp;quot;); &lt;br /&gt;
    t1.showStyle(); &lt;br /&gt;
    t1.showDim(); &lt;br /&gt;
    Console.WriteLine(&amp;quot;Area is &amp;quot; + t1.area()); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(&amp;quot;Info for t2: &amp;quot;); &lt;br /&gt;
    t2.showStyle(); &lt;br /&gt;
    t2.showDim(); &lt;br /&gt;
    Console.WriteLine(&amp;quot;Area is &amp;quot; + t2.area()); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(&amp;quot;Info for t3: &amp;quot;); &lt;br /&gt;
    t3.showStyle(); &lt;br /&gt;
    t3.showDim(); &lt;br /&gt;
    Console.WriteLine(&amp;quot;Area is &amp;quot; + t3.area()); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(); &lt;br /&gt;
  } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==A parameterized constructor==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C#: The Complete Reference &lt;br /&gt;
by Herbert Schildt &lt;br /&gt;
Publisher: Osborne/McGraw-Hill (March 8, 2002)&lt;br /&gt;
ISBN: 0072134852&lt;br /&gt;
*/&lt;br /&gt;
// A parameterized constructor. &lt;br /&gt;
 &lt;br /&gt;
using System; &lt;br /&gt;
 &lt;br /&gt;
class MyClass { &lt;br /&gt;
  public int x; &lt;br /&gt;
 &lt;br /&gt;
  public MyClass(int i) { &lt;br /&gt;
    x = i; &lt;br /&gt;
  }   &lt;br /&gt;
}   &lt;br /&gt;
   &lt;br /&gt;
public class ParmConsDemo {   &lt;br /&gt;
  public static void Main() {   &lt;br /&gt;
    MyClass t1 = new MyClass(10); &lt;br /&gt;
    MyClass t2 = new MyClass(88); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(t1.x + &amp;quot; &amp;quot; + t2.x); &lt;br /&gt;
  }   &lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==A simple constructor==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C#: The Complete Reference &lt;br /&gt;
by Herbert Schildt &lt;br /&gt;
Publisher: Osborne/McGraw-Hill (March 8, 2002)&lt;br /&gt;
ISBN: 0072134852&lt;br /&gt;
*/&lt;br /&gt;
// A simple constructor. &lt;br /&gt;
 &lt;br /&gt;
using System; &lt;br /&gt;
 &lt;br /&gt;
class MyClass { &lt;br /&gt;
  public int x; &lt;br /&gt;
 &lt;br /&gt;
  public MyClass() { &lt;br /&gt;
    x = 10; &lt;br /&gt;
  }   &lt;br /&gt;
}   &lt;br /&gt;
   &lt;br /&gt;
public class ConsDemo1 {   &lt;br /&gt;
  public static void Main() {   &lt;br /&gt;
    MyClass t1 = new MyClass(); &lt;br /&gt;
    MyClass t2 = new MyClass(); &lt;br /&gt;
 &lt;br /&gt;
    Console.WriteLine(t1.x + &amp;quot; &amp;quot; + t2.x); &lt;br /&gt;
  }   &lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==C# Class Constructor Overloading==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public Overloading&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        Point myPoint = new Point(10, 15);&lt;br /&gt;
        Point mySecondPoint = new Point(myPoint);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
class Point&lt;br /&gt;
{&lt;br /&gt;
    // create a new point from x and y values&lt;br /&gt;
    public Point(int x, int y)&lt;br /&gt;
    {&lt;br /&gt;
        this.x = x;&lt;br /&gt;
        this.y = y;&lt;br /&gt;
    }&lt;br /&gt;
    // create a point from an existing point&lt;br /&gt;
    public Point(Point p)&lt;br /&gt;
    {&lt;br /&gt;
        this.x = p.x;&lt;br /&gt;
        this.y = p.y;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Check the parameter in construtor==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
public class Class1 {&lt;br /&gt;
    public static void Main(string[] args) {&lt;br /&gt;
        Student student = new Student(&amp;quot;AAA&amp;quot;, 1234);&lt;br /&gt;
        Console.WriteLine(&amp;quot;Welcome new student {0}&amp;quot;, student.GetString());&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
public class Student {&lt;br /&gt;
    string sStudentName;&lt;br /&gt;
    int nStudentID;&lt;br /&gt;
    int nCreditHours;&lt;br /&gt;
    public Student(string sName, int nID) {&lt;br /&gt;
        if (sName == null) {&lt;br /&gt;
            sName = &amp;quot;invalid&amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
        sStudentName = sName;&lt;br /&gt;
        if (nID &amp;lt; 0) {&lt;br /&gt;
            nID = 0;&lt;br /&gt;
        }&lt;br /&gt;
        nStudentID = nID;&lt;br /&gt;
        nCreditHours = 0;&lt;br /&gt;
    }&lt;br /&gt;
    public string GetString() {&lt;br /&gt;
        string s = String.Format(&amp;quot;{0}({1})&amp;quot;,sStudentName, nStudentID);&lt;br /&gt;
        return s;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==constructor initializers are called bottom-up but the constructors are invoked top-down starting with the constructor in the base class==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
public class Starter {&lt;br /&gt;
    public static void Main() {&lt;br /&gt;
        XClass obj = new XClass();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
public class MyClass {&lt;br /&gt;
    public MyClass(int param) {&lt;br /&gt;
        Console.WriteLine(&amp;quot;MyClass constructor&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
public class YClass : MyClass {&lt;br /&gt;
    public YClass(int param) : base(YClass.MethodA()) {&lt;br /&gt;
        Console.WriteLine(&amp;quot;YClass constructor&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    public static int MethodA() {&lt;br /&gt;
        Console.WriteLine(&amp;quot;YClass constructor initializer&amp;quot;);&lt;br /&gt;
        return 0;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
public class XClass : YClass {&lt;br /&gt;
    public XClass() : base(XClass.MethodA()) {&lt;br /&gt;
        Console.WriteLine(&amp;quot;XClass constructor&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    public static new int MethodA() {&lt;br /&gt;
        Console.WriteLine(&amp;quot;XClass constructor initializer&amp;quot;);&lt;br /&gt;
        return 0;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Constructor overloading 3==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * C# Programmers Pocket Consultant&lt;br /&gt;
 * Author: Gregory S. MacBeth&lt;br /&gt;
 * Email: gmacbeth@comporium.net&lt;br /&gt;
 * Create Date: June 27, 2003&lt;br /&gt;
 * Last Modified Date:&lt;br /&gt;
 */&lt;br /&gt;
using System;&lt;br /&gt;
namespace Client.Chapter_5___Building_Your_Own_Classes&lt;br /&gt;
{&lt;br /&gt;
  public class CTORChapter&lt;br /&gt;
  {&lt;br /&gt;
    public int[] MyIntArray;&lt;br /&gt;
    public int Y;&lt;br /&gt;
    //Initialization can take place here&lt;br /&gt;
    private int ObjectCount = 0;&lt;br /&gt;
    static void Main(string[] args)&lt;br /&gt;
    {&lt;br /&gt;
      CTORChapter X = new CTORChapter();&lt;br /&gt;
      X.ObjectCount++;&lt;br /&gt;
      CTORChapter YY = new CTORChapter(10);&lt;br /&gt;
    }&lt;br /&gt;
    //Default CTORChapter&lt;br /&gt;
    CTORChapter()&lt;br /&gt;
    {&lt;br /&gt;
      MyIntArray = new int[10];&lt;br /&gt;
      //Do work necessary during object creation&lt;br /&gt;
    }&lt;br /&gt;
    //Overloads the CTOR allowing you to initialize Y&lt;br /&gt;
    CTORChapter(int myY)&lt;br /&gt;
    {&lt;br /&gt;
      Y = myY;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Demonstrate an overloaded constructor==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C#: The Complete Reference &lt;br /&gt;
by Herbert Schildt &lt;br /&gt;
Publisher: Osborne/McGraw-Hill (March 8, 2002)&lt;br /&gt;
ISBN: 0072134852&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// Demonstrate an overloaded constructor. &lt;br /&gt;
 &lt;br /&gt;
using System; &lt;br /&gt;
 &lt;br /&gt;
class MyClass {  &lt;br /&gt;
  public int x;  &lt;br /&gt;
  &lt;br /&gt;
  public MyClass() { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Inside MyClass().&amp;quot;); &lt;br /&gt;
    x = 0; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public MyClass(int i) {  &lt;br /&gt;
    Console.WriteLine(&amp;quot;Inside MyClass(int).&amp;quot;); &lt;br /&gt;
    x = i;  &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public MyClass(double d) { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Inside MyClass(double).&amp;quot;); &lt;br /&gt;
    x = (int) d; &lt;br /&gt;
  } &lt;br /&gt;
 &lt;br /&gt;
  public MyClass(int i, int j) { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Inside MyClass(int, int).&amp;quot;); &lt;br /&gt;
    x = i * j; &lt;br /&gt;
  }    &lt;br /&gt;
}    &lt;br /&gt;
    &lt;br /&gt;
public class OverloadConsDemo {    &lt;br /&gt;
  public static void Main() {    &lt;br /&gt;
    MyClass t1 = new MyClass();  &lt;br /&gt;
    MyClass t2 = new MyClass(88);  &lt;br /&gt;
    MyClass t3 = new MyClass(17.23);  &lt;br /&gt;
    MyClass t4 = new MyClass(2, 4);  &lt;br /&gt;
  &lt;br /&gt;
    Console.WriteLine(&amp;quot;t1.x: &amp;quot; + t1.x); &lt;br /&gt;
    Console.WriteLine(&amp;quot;t2.x: &amp;quot; + t2.x); &lt;br /&gt;
    Console.WriteLine(&amp;quot;t3.x: &amp;quot; + t3.x); &lt;br /&gt;
    Console.WriteLine(&amp;quot;t4.x: &amp;quot; + t4.x); &lt;br /&gt;
  }    &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Demonstrate invoking a constructor through this==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C#: The Complete Reference &lt;br /&gt;
by Herbert Schildt &lt;br /&gt;
Publisher: Osborne/McGraw-Hill (March 8, 2002)&lt;br /&gt;
ISBN: 0072134852&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// Demonstrate invoking a constructor through this. &lt;br /&gt;
  &lt;br /&gt;
using System;  &lt;br /&gt;
  &lt;br /&gt;
class XYCoord {   &lt;br /&gt;
  public int x, y;   &lt;br /&gt;
   &lt;br /&gt;
  public XYCoord() : this(0, 0) { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Inside XYCoord()&amp;quot;); &lt;br /&gt;
  }  &lt;br /&gt;
 &lt;br /&gt;
  public XYCoord(XYCoord obj) : this(obj.x, obj.y) { &lt;br /&gt;
    Console.WriteLine(&amp;quot;Inside XYCoord(obj)&amp;quot;); &lt;br /&gt;
  }  &lt;br /&gt;
 &lt;br /&gt;
  public XYCoord(int i, int j) {  &lt;br /&gt;
    Console.WriteLine(&amp;quot;Inside XYCoord(int, int)&amp;quot;); &lt;br /&gt;
    x = i; &lt;br /&gt;
    y = j; &lt;br /&gt;
  }     &lt;br /&gt;
}     &lt;br /&gt;
     &lt;br /&gt;
public class OverloadConsDemo1 {     &lt;br /&gt;
  public static void Main() {     &lt;br /&gt;
    XYCoord t1 = new XYCoord();   &lt;br /&gt;
    XYCoord t2 = new XYCoord(8, 9);   &lt;br /&gt;
    XYCoord t3 = new XYCoord(t2);   &lt;br /&gt;
   &lt;br /&gt;
    Console.WriteLine(&amp;quot;t1.x, t1.y: &amp;quot; + t1.x + &amp;quot;, &amp;quot; + t1.y);  &lt;br /&gt;
    Console.WriteLine(&amp;quot;t2.x, t2.y: &amp;quot; + t2.x + &amp;quot;, &amp;quot; + t2.y);  &lt;br /&gt;
    Console.WriteLine(&amp;quot;t3.x, t3.y: &amp;quot; + t3.x + &amp;quot;, &amp;quot; + t3.y);  &lt;br /&gt;
  }     &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Illustrates a copy constructor==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Mastering Visual C# .NET&lt;br /&gt;
by Jason Price, Mike Gunderloy&lt;br /&gt;
Publisher: Sybex;&lt;br /&gt;
ISBN: 0782129110&lt;br /&gt;
*/&lt;br /&gt;
/*&lt;br /&gt;
  Example5_13.cs illustrates a copy constructor&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// declare the Car class&lt;br /&gt;
class Car&lt;br /&gt;
{&lt;br /&gt;
  // declare the fields&lt;br /&gt;
  private string make;&lt;br /&gt;
  private string model;&lt;br /&gt;
  private string color;&lt;br /&gt;
  private int yearBuilt;&lt;br /&gt;
  // define the copy constructor&lt;br /&gt;
  public Car(Car car)&lt;br /&gt;
  {&lt;br /&gt;
    this.make = car.make;&lt;br /&gt;
    this.model = car.model;&lt;br /&gt;
    this.color = car.color;&lt;br /&gt;
    this.yearBuilt = car.yearBuilt;&lt;br /&gt;
  }&lt;br /&gt;
  public Car(string make, string model, string color, int yearBuilt)&lt;br /&gt;
  {&lt;br /&gt;
    this.make = make;&lt;br /&gt;
    this.model = model;&lt;br /&gt;
    this.color = color;&lt;br /&gt;
    this.yearBuilt = yearBuilt;&lt;br /&gt;
  }&lt;br /&gt;
  // define method to display the fields&lt;br /&gt;
  public void Display()&lt;br /&gt;
  {&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;make = &amp;quot; + make);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;model = &amp;quot; + model);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;color = &amp;quot; + color);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;yearBuilt = &amp;quot; + yearBuilt);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class Example5_13&lt;br /&gt;
{&lt;br /&gt;
  public static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    // create a Car object&lt;br /&gt;
    Car myCar = new Car(&amp;quot;Toyota&amp;quot;, &amp;quot;MR2&amp;quot;, &amp;quot;black&amp;quot;, 1995);&lt;br /&gt;
    // create a copy of this Car object&lt;br /&gt;
    Car carCopy = new Car(myCar);&lt;br /&gt;
    // display the values for the Car object&amp;quot;s fields&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;myCar details:&amp;quot;);&lt;br /&gt;
    myCar.Display();&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;carCopy details:&amp;quot;);&lt;br /&gt;
    carCopy.Display();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Illustrates how to define a constructor==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Mastering Visual C# .NET&lt;br /&gt;
by Jason Price, Mike Gunderloy&lt;br /&gt;
Publisher: Sybex;&lt;br /&gt;
ISBN: 0782129110&lt;br /&gt;
*/&lt;br /&gt;
/*&lt;br /&gt;
  Example5_11.cs illustrates how to define a constructor&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// declare the Car class&lt;br /&gt;
class Car&lt;br /&gt;
{&lt;br /&gt;
  // declare the fields&lt;br /&gt;
  private string make;&lt;br /&gt;
  private string model;&lt;br /&gt;
  private string color;&lt;br /&gt;
  private int yearBuilt;&lt;br /&gt;
  // define the constructor&lt;br /&gt;
  public Car(string make, string model, string color, int yearBuilt)&lt;br /&gt;
  {&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;In Car() constructor&amp;quot;);&lt;br /&gt;
    this.make = make;&lt;br /&gt;
    this.model = model;&lt;br /&gt;
    this.color = color;&lt;br /&gt;
    this.yearBuilt = yearBuilt;&lt;br /&gt;
  }&lt;br /&gt;
  // define a method to display the fields&lt;br /&gt;
  public void Display()&lt;br /&gt;
  {&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;Car details:&amp;quot;);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;make = &amp;quot; + make);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;model = &amp;quot; + model);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;color = &amp;quot; + color);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;yearBuilt = &amp;quot; + yearBuilt);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class Example5_11&lt;br /&gt;
{&lt;br /&gt;
  public static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    // create a Car object using the constructor&lt;br /&gt;
    // defined in the class&lt;br /&gt;
    Car myCar = new Car(&amp;quot;Toyota&amp;quot;, &amp;quot;MR2&amp;quot;, &amp;quot;black&amp;quot;, 1995);&lt;br /&gt;
    // display the values for the Car object fields&lt;br /&gt;
    myCar.Display();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Illustrates overloaded constructors==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Mastering Visual C# .NET&lt;br /&gt;
by Jason Price, Mike Gunderloy&lt;br /&gt;
Publisher: Sybex;&lt;br /&gt;
ISBN: 0782129110&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
  Example5_12.cs illustrates overloaded constructors&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// declare the Car class&lt;br /&gt;
class Car&lt;br /&gt;
{&lt;br /&gt;
  // declare the fields&lt;br /&gt;
  private string make;&lt;br /&gt;
  private string model;&lt;br /&gt;
  private string color;&lt;br /&gt;
  private int yearBuilt;&lt;br /&gt;
  // define the overloaded constructors&lt;br /&gt;
  public Car()&lt;br /&gt;
  {&lt;br /&gt;
    this.make = &amp;quot;Ford&amp;quot;;&lt;br /&gt;
    this.model = &amp;quot;Mustang&amp;quot;;&lt;br /&gt;
    this.color = &amp;quot;red&amp;quot;;&lt;br /&gt;
    this.yearBuilt = 1970;&lt;br /&gt;
  }&lt;br /&gt;
  public Car(string make)&lt;br /&gt;
  {&lt;br /&gt;
    this.make = make;&lt;br /&gt;
    this.model = &amp;quot;Corvette&amp;quot;;&lt;br /&gt;
    this.color = &amp;quot;silver&amp;quot;;&lt;br /&gt;
    this.yearBuilt = 1969;&lt;br /&gt;
  }&lt;br /&gt;
  public Car(string make, string model, string color, int yearBuilt)&lt;br /&gt;
  {&lt;br /&gt;
    this.make = make;&lt;br /&gt;
    this.model = model;&lt;br /&gt;
    this.color = color;&lt;br /&gt;
    this.yearBuilt = yearBuilt;&lt;br /&gt;
  }&lt;br /&gt;
  // define method to display the fields&lt;br /&gt;
  public void Display()&lt;br /&gt;
  {&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;make = &amp;quot; + make);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;model = &amp;quot; + model);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;color = &amp;quot; + color);&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;yearBuilt = &amp;quot; + yearBuilt);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class Example5_12&lt;br /&gt;
{&lt;br /&gt;
  public static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    // create three Car objects using the constructors&lt;br /&gt;
    // defined in the class&lt;br /&gt;
    Car myCar = new Car(&amp;quot;Toyota&amp;quot;, &amp;quot;MR2&amp;quot;, &amp;quot;black&amp;quot;, 1995);&lt;br /&gt;
    Car myCar2 = new Car();&lt;br /&gt;
    Car myCar3 = new Car(&amp;quot;Chevrolet&amp;quot;);&lt;br /&gt;
    // display the values for the Car object&amp;quot;s fields&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;myCar details:&amp;quot;);&lt;br /&gt;
    myCar.Display();&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;myCar2 details:&amp;quot;);&lt;br /&gt;
    myCar2.Display();&lt;br /&gt;
    System.Console.WriteLine(&amp;quot;myCar3 details:&amp;quot;);&lt;br /&gt;
    myCar3.Display();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Shows the order in which constructors and destructors are called in a C# program==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C# Programming Tips &amp;amp; Techniques&lt;br /&gt;
by Charles Wright, Kris Jamsa&lt;br /&gt;
Publisher: Osborne/McGraw-Hill (December 28, 2001)&lt;br /&gt;
ISBN: 0072193794&lt;br /&gt;
*/&lt;br /&gt;
// Order.cs - shows the order in which constructors and destructors&lt;br /&gt;
//            are called in a C# program.&lt;br /&gt;
//&lt;br /&gt;
//            Compile this program with the following command line:&lt;br /&gt;
//                C:&amp;gt;csc Order.cs&lt;br /&gt;
//&lt;br /&gt;
namespace nsOrder&lt;br /&gt;
{&lt;br /&gt;
    using System;&lt;br /&gt;
    &lt;br /&gt;
    public class clsMainOrder&lt;br /&gt;
    {&lt;br /&gt;
        static public void Main ()&lt;br /&gt;
        {&lt;br /&gt;
            clsLastChild child = new clsLastChild ();&lt;br /&gt;
            Console.WriteLine ();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
//&lt;br /&gt;
// Declare a base class and have its constructor and destructors&lt;br /&gt;
// print messages.&lt;br /&gt;
    class clsBase&lt;br /&gt;
    {&lt;br /&gt;
        public clsBase ()&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine (&amp;quot;Base class constructor called&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        ~clsBase ()&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine (&amp;quot;Base class destructor called&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
// Derive a class from clsBase. Have the constructor and destructor&lt;br /&gt;
// print messages.&lt;br /&gt;
    class clsFirstChild : clsBase&lt;br /&gt;
    {&lt;br /&gt;
        public clsFirstChild ()&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine (&amp;quot;First Child constructor called&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        ~clsFirstChild ()&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine (&amp;quot;First Child destructor called&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
// Derive a class from clsFirstChile. Have the constructor and destructor&lt;br /&gt;
// print messages as well.&lt;br /&gt;
    class clsLastChild  : clsFirstChild&lt;br /&gt;
    {&lt;br /&gt;
        public clsLastChild ()&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine (&amp;quot;Last Child constructor called&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        ~clsLastChild ()&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine (&amp;quot;Last Child destructor called&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>