Class Shapes Learn programming C#

Lesson:

OOP Object Oriented Programming


Exercise:

Class Shapes


Objetive:

Using Visual Studio, create a project and the corresponding classes (using several files) for this classes diagram.


Code:

using System;
namespace shapes
{
    class Circle : Shape
    {
        protected double radius;
    }
}

using System;
namespace shapes
{
    class Location
    {
        private double x, y;
    }
}

using System;
namespace shapes
{
    class Rectangle : Shape
    {
        protected double side1, side2;
    }
}

using System;
namespace shapes
{
    class Shape
    {
        protected Location c;

        public string ToString()
        {
            return "";
        }

        public double Area()
        {
            return 0.000;
        }

        public double Perimeter()
        {
            return 0.000;
        }
    }
}

using System;
namespace shapes
{
    class TestShape
    {
        static void Main(string[] args)
        {

        }
    }
}

Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.