Web proxy server - Chapter 10 Object-Oriented Programming: Polymorphism 397 // Fig.

Chapter 10 Object-Oriented Programming: Polymorphism 397 // Fig. 10.6: Circle2.cs // Circle2 inherits from class Point2 and overrides key members. using System; // Circle2 inherits from class Point2 public class Circle2 : Point2 { private double radius; // Circle2 radius // default constructor public Circle2() { // implicit call to Point2 constructor occurs here } // constructor public Circle2( int xValue, int yValue, double radiusValue ) : base( xValue, yValue ) { Radius = radiusValue; } // property Radius public double Radius { get { return radius; } set { // ensure non-negative radius value if ( value >= 0 ) radius = value; } } // calculate Circle2 diameter public double Diameter() { return Radius * 2; } // calculate Circle2 circumference public double Circumference() { return Math.PI * Diameter(); } // calculate Circle2 area public override double Area() { Fig. 10.6 Fig. 10.6Fig. 10FiFi.6g. 10.6g. 10.6Circle2class that inherits from class Point2. (Part 1 of 2.)
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

Leave a Reply