• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Lab4.Rectangle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Lab4.Rectangle的典型用法代码示例。如果您正苦于以下问题:C# Rectangle类的具体用法?C# Rectangle怎么用?C# Rectangle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Rectangle类属于Lab4命名空间,在下文中一共展示了Rectangle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Main

        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));
        }
开发者ID:janejiraaa,项目名称:week-401,代码行数:29,代码来源:Program.cs


示例2: Main

        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");
        }
开发者ID:JJanjao,项目名称:week-4,代码行数:13,代码来源:Program.cs


示例3: Main

        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();
        }
开发者ID:cpe200-158-sec2-0613,项目名称:week-4,代码行数:14,代码来源:Program.cs


示例4: Rectangle

 public Rectangle(Rectangle a)
 {
     setValue(a.width,a.height); setColor(a.color);
 }
开发者ID:cpe200-158-sec2-0600,项目名称:week-4,代码行数:4,代码来源:Rectangle.cs


示例5: Triangle

 public Triangle(Rectangle R)
     : base(R.Color)
 {
     this.Width = R.Width;
     this.Height = R.Height;
 }
开发者ID:cpe200-158-sec2-0581,项目名称:week-4,代码行数:6,代码来源:Triangle.cs


示例6: Rectangle

 public Rectangle(Rectangle pRectangle)
     : base(pRectangle.Color)
 {
     Width = pRectangle.Width;
     Height = pRectangle.Height;
 }
开发者ID:cpe200-158-sec1-0601,项目名称:week-4,代码行数:6,代码来源:Rectangle.cs


示例7: Rectangle

 public Rectangle(Rectangle rec)
     : base(rec.Color)
 {
     Width = rec.Width;
     Height = rec.Height;
 }
开发者ID:cpe200-158-sec2-0588,项目名称:week-4,代码行数:6,代码来源:Rectangle.cs


示例8: Rectangle

 // : base(a.Color)
 public Rectangle(Rectangle a)
 {
     _color = a.Color; // -
     Height = a.Height;
     Width = a.Width;
 }
开发者ID:cpe200-158-sec2-0607,项目名称:week-4,代码行数:7,代码来源:Rectangle.cs


示例9: Rectangle

 public Rectangle(Rectangle re)
 {
     color = re.Color;
     width = re.width;
     height = re.height;
 }
开发者ID:cpe200-158-sec1-0621,项目名称:week-4,代码行数:6,代码来源:Rectangle.cs


示例10: printPerimeter

 public static double printPerimeter(Rectangle r)
 {
     return r.getPerimeter();
 }
开发者ID:cpe200-158-sec1-0619,项目名称:week-4,代码行数:4,代码来源:Program.cs


示例11: Rectangle

 public Rectangle(Rectangle a)
     : base(a.Color)
 {
     Height = a.Height;
     Width = a.Width;
 }
开发者ID:cpe200-158-sec2-0550,项目名称:week-4,代码行数:6,代码来源:Rectangle.cs


示例12: Rectangle

 //- Rectangle(Rectangle): copy constructor
 public Rectangle(Rectangle inRec)
     : base(inRec.Color)
 {
     Width = inRec.Width;
     Height = inRec.Height;
 }
开发者ID:cpe200-158-sec1-0577,项目名称:week-4,代码行数:7,代码来源:Rectangle.cs


示例13: Rectangle

 public Rectangle(Rectangle a)
 {
     Height = a.Height;
     Width = a.Width;
     color = a.Color;
 }
开发者ID:cpe200-158-sec1-0608,项目名称:week-4,代码行数:6,代码来源:Rectangle.cs


示例14: Rectangle

 public Rectangle(Rectangle obj)
 {
     _color = obj._color;
     _width = obj.Width;
     _height = obj.Height;
 }
开发者ID:cpe200-158-sec1-0574,项目名称:week-4,代码行数:6,代码来源:Rectangle.cs


示例15: Rectangle

 public Rectangle(Rectangle r)
     : base(r.color)
 {
     _Height = r._Height;
     _Width = r._Width;
 }
开发者ID:nrtdemo,项目名称:week-4,代码行数:6,代码来源:Rectangle.cs


示例16: Rectangle

 public Rectangle(Rectangle a)
 {
     _c = a.Color;
     Width = a.Width;
     Height = a.Height;
 }
开发者ID:cpe200-158-sec2-0613,项目名称:week-4,代码行数:6,代码来源:Rectangle.cs


示例17: Rectangle

 public Rectangle(Rectangle r)
 {
     _color = r.color;
     _height = r.height;
     _width = r.width;
 }
开发者ID:cpe200-158-sec1-0549,项目名称:week-4,代码行数:6,代码来源:Rectangle.cs


示例18: Rectangle

 public Rectangle(Rectangle cpy)
     : base(cpy.color)
 {
     width = cpy.width;
     height = cpy.height;
 }
开发者ID:cpe200-158-sec1-0614,项目名称:week-4,代码行数:6,代码来源:Rectangle.cs


示例19: Rectangle

 public Rectangle(Rectangle a)
 {
     Width = a.Width;
     Height = a.Height;
     color = a.color;
 }
开发者ID:cpe200-158-sec2-0589,项目名称:week-4,代码行数:6,代码来源:Rectangle.cs


示例20: printPerimeter

 public static double printPerimeter(Rectangle pRectangle)
 {
     return pRectangle.getPerimeter();
 }
开发者ID:cpe200-158-sec1-0601,项目名称:week-4,代码行数:4,代码来源:Program.cs



注:本文中的Lab4.Rectangle类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Lab601.Herbivore类代码示例发布时间:2022-05-26
下一篇:
C# Lab4.Circle类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap