Esempio 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));
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            Shape s1 = new Rectangle("red", 4, 5);
            Console.WriteLine (s1);
            Console.WriteLine ("Area is " + s1.getArea());

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

            // Cannot create instance of an abstract class - Compilation Error!!
            //      Shape s3 = new Shape("green");
        }
Esempio n. 3
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 s1: "+printPerimeter (s1));
                        Console.WriteLine ("Perimeter s1: "+printPerimeter (s2));
                        Console.WriteLine ("Perimeter s1: "+printPerimeter (s3));
                        Console.WriteLine ("Perimeter s1: "+printPerimeter (r1));
                        Console.WriteLine ("Perimeter s1: "+printPerimeter (t1));
            Console.ReadKey();
        }
Esempio n. 4
0
 public Rectangle(Rectangle a)
 {
     setValue(a.width,a.height); setColor(a.color);
 }
Esempio n. 5
0
 public Triangle(Rectangle R)
     : base(R.Color)
 {
     this.Width = R.Width;
     this.Height = R.Height;
 }
Esempio n. 6
0
 public Rectangle(Rectangle pRectangle)
     : base(pRectangle.Color)
 {
     Width = pRectangle.Width;
     Height = pRectangle.Height;
 }
Esempio n. 7
0
 public Rectangle(Rectangle rec)
     : base(rec.Color)
 {
     Width = rec.Width;
     Height = rec.Height;
 }
Esempio n. 8
0
 // : base(a.Color)
 public Rectangle(Rectangle a)
 {
     _color = a.Color; // -
     Height = a.Height;
     Width = a.Width;
 }
Esempio n. 9
0
 public Rectangle(Rectangle re)
 {
     color = re.Color;
     width = re.width;
     height = re.height;
 }
Esempio n. 10
0
 public static double printPerimeter(Rectangle r)
 {
     return r.getPerimeter();
 }
Esempio n. 11
0
 public Rectangle(Rectangle a)
     : base(a.Color)
 {
     Height = a.Height;
     Width = a.Width;
 }
Esempio n. 12
0
 //- Rectangle(Rectangle): copy constructor
 public Rectangle(Rectangle inRec)
     : base(inRec.Color)
 {
     Width = inRec.Width;
     Height = inRec.Height;
 }
Esempio n. 13
0
 public Rectangle(Rectangle a)
 {
     Height = a.Height;
     Width = a.Width;
     color = a.Color;
 }
Esempio n. 14
0
 public Rectangle(Rectangle obj)
 {
     _color = obj._color;
     _width = obj.Width;
     _height = obj.Height;
 }
Esempio n. 15
0
 public Rectangle(Rectangle r)
     : base(r.color)
 {
     _Height = r._Height;
     _Width = r._Width;
 }
Esempio n. 16
0
 public Rectangle(Rectangle a)
 {
     _c = a.Color;
     Width = a.Width;
     Height = a.Height;
 }
Esempio n. 17
0
 public Rectangle(Rectangle r)
 {
     _color = r.color;
     _height = r.height;
     _width = r.width;
 }
Esempio n. 18
0
 public Rectangle(Rectangle cpy)
     : base(cpy.color)
 {
     width = cpy.width;
     height = cpy.height;
 }
Esempio n. 19
0
 public Rectangle(Rectangle a)
 {
     Width = a.Width;
     Height = a.Height;
     color = a.color;
 }
Esempio n. 20
0
 public static double printPerimeter(Rectangle pRectangle)
 {
     return pRectangle.getPerimeter();
 }
Esempio n. 21
0
 public Triangle(Rectangle a)
     : base(a.color)
 {
     Width = a.Width;
     Height = a.Height;
 }
Esempio n. 22
0
 public Triangle(Rectangle i)
     : base(i.Color)
 {
     Width = i.Width;
     Height = i.Height;
 }
Esempio n. 23
0
 public Rectangle(Rectangle r)
     : base(r.Color)
 {
     Height = r.Height;
     Width = r.Width;
 }
Esempio n. 24
0
 public Triangle(Rectangle t)
 {
     Height = t.Height;
     Width = t.Width;
     _Color = t.Color;
 }
Esempio n. 25
0
 public Rectangle(Rectangle obj)
     : base(obj.Color)
 {
     Width = obj.Width;
     Height = obj.Height;
 }
Esempio n. 26
0
 public Rectangle(Rectangle r)
     : base(r.color)
 {
     Width = r.Width;
     Height = r.Height;
 }
Esempio n. 27
0
 public Rectangle(Rectangle r)
 {
     Height = r.Height;
     Width = r.Width;
     _Color = r.Color;
 }
Esempio n. 28
0
 public Rectangle(Rectangle r)
     : base(r.color)
 {
     _width = r._width;
     _height = r._height;
 }
Esempio n. 29
0
 public Rectangle(Rectangle R)
     : base(R.color)
 {
     _Width = R.Width;
     _Height = R.Height;
 }
Esempio n. 30
0
 public Triangle(Rectangle r)
     : base(r.Color)
 {
     width = r.Width;
     height = r.Height;
 }