a575963da9
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
22 lines
858 B
XML
22 lines
858 B
XML
<?xml version="1.0"?>
|
|
<clause number="8.7.9" title="Destructors" informative="true">
|
|
<paragraph>A destructor is a member that implements the actions required to destruct an instance of a class. Destructors cannot have parameters, they cannot have accessibility modifiers, and they cannot be called explicitly. The destructor for an instance is called automatically during garbage collection. </paragraph>
|
|
<paragraph>The example <code_example><![CDATA[
|
|
using System;
|
|
class Point
|
|
{
|
|
public double x, y;
|
|
public Point(double x, double y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
~Point() {
|
|
Console.WriteLine("Destructed {0}", this);
|
|
}
|
|
public override string ToString() {
|
|
return string.Format("({0}, {1})", x, y);
|
|
}
|
|
}
|
|
]]></code_example>shows a Point class with a destructor. </paragraph>
|
|
</clause>
|