First page Back Continue Last page Overview Graphics
Örnek Casting
Point point1 = new Point( 30, 50 );
Circle circle1 = new Circle( 120, 89, 2.7 );
string output = "Point point1: " + point1.ToString() +
"\nCircle circle1: " + circle1.ToString();
Point point2 = circle1;
output += "\n\nCCircle circle1 (via point2): " +
point2.ToString();
//downcast
Circle circle2 = ( Circle ) point2;
output += "\n\nCircle circle1 (via circle2): " +
circle2.ToString();
output += "\nArea of circle1 (via circle2): " +
circle2.Area().ToString( "F" );