Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            Shape s1 = new Rectangle("red", 4, 5);
            Console.WriteLine (s1);

            Shape s2 = new Triangle("blue", 4, 5);
            Console.WriteLine (s2);

            Shape s3 = new Rectangle();
            Console.WriteLine (s3);

            Rectangle r1 = new Rectangle((Rectangle)s1);
            Console.WriteLine (r1);
            r1.Width=-5.0; r1.Height=15;
            Console.WriteLine (r1);

            Triangle t1 = new Triangle();
            t1.Width=3; t1.Height=4;
            Console.WriteLine (t1);

            //Shape s4 = new Shape("green");
            //Console.WriteLine (s4);

            Console.WriteLine ("Perimeter of s1: {0}",printPerimeter (s1));
            Console.WriteLine ("Perimeter of s2: {0}",printPerimeter (s2));
            Console.WriteLine ("Perimeter of s3: {0}",printPerimeter (s3));
            Console.WriteLine ("Perimeter of r1: {0}",printPerimeter (r1));
            Console.WriteLine ("Perimeter of t1: {0}",printPerimeter (t1));
        }
Ejemplo n.º 2
0
 public static double printPerimeter(Triangle s)
 {
     return s.getPerimeter();
 }
Ejemplo n.º 3
0
 public Triangle(Triangle t)
     : base(t.Color)
 {
     Width = t.Width;
     Height = t.Height;
 }
Ejemplo n.º 4
0
 public Triangle(Triangle T)
     : base(T.Color)
 {
     _height = T.Height;
     _width = T.Width;
 }
Ejemplo n.º 5
0
 public Triangle(Triangle r)
     : base(r.color)
 {
     Width = r.Width;
     Height = r.Height;
 }
Ejemplo n.º 6
0
 public Triangle(Triangle A)
     : base(A.Color)
 {
     Width = A.Width;
     Height = A.Height;
 }
Ejemplo n.º 7
0
 //- Triangle(Rectangle) : copy constructor
 public Triangle(Triangle t)
 {
     _color = t._color;
     Width = t.Width;
     Height = t.Height;
 }
Ejemplo n.º 8
0
 public Triangle(Triangle t)
     : base(t.Color)
 {
     _Width = t._Width;
     _Height = t._Height;
 }
Ejemplo n.º 9
0
 public Triangle(Triangle t1)
     : base(t1.Color)
 {
     _width = t1.Width;
     _height = t1.Height;
 }
Ejemplo n.º 10
0
 public Triangle(Triangle t)
 {
     _color = t.Color;
     _height = t.Height;
     _width = t.Width;
 }
Ejemplo n.º 11
0
 public Triangle(Triangle triangle)
     : base(triangle.Color)
 {
     width = triangle.width;
     height = triangle.height;
 }
Ejemplo n.º 12
0
 public static double printPerimeter(Triangle s)
 {
     return(s.getPerimeter());
 }
Ejemplo n.º 13
0
 public Triangle(Triangle t)
 {
     _Color = t._Color;
     Width = t._Width;
     Height = t._Height;
 }
Ejemplo n.º 14
0
 public Triangle(Triangle t)
 {
     Width = t.Width;
     Height = t.Height;
     _Color = t._Color;
 }