using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Cylinder c1 = new Cylinder(10, 5);
            Circle x = new Circle();
            x.Radius = 5;            
            
            Circle.pi = 10;           
            //c.Radius = 5;
            //MessageBox.Show(c1.Volume().ToString());
            MessageBox.Show(x.Pyramid().ToString());          

        }
    }
    //sealed class Circle
    //abstract class Circle
    public class Circle
    {
        public static double pi = 3.14;
        protected double test;
        internal double internalmember;
        private Double _Radius;
        public Double Radius
        {
            get { return _Radius; }
            set
            {
                if (value < 0)
                    //throw new Exception("Radius Is Negative");
                    _Radius = 0;
                else
                    _Radius = value;
            }
        }
        virtual public Double Area()
        {
            return (Math.PI * Radius * Radius);
        }
        public Double Pyramid()
        {
            return (2 * pi * Radius);
        }
    }
    class Cylinder : Circle  //Derived 
    {
        public double Height;
        override public double Area()
        {
            return (Pyramid() * Height + 2 * base.Area());                        
        }
        public double Volume()
        {
            return Height * base.Area();
        }
        public Cylinder(double Height)
        {
            Radius = 0;
            this.Height = Height;
        }
        public Cylinder(double Radius, double Height)
        {
            this.Radius = Radius;
            this.Height = Height;
        }
        public Cylinder()
        {
            Radius = Height = 0;
        }
    }    
}
