打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
构造函数属性
using System;
public class Square
{
private int sidelong;
 public Square()
 {
 Console.WriteLine ("我没有参数.");
 }
 public Square(int sidelong)
 {
 this.sidelong=sidelong;
 }
 public int Setsidelong(int sidelong)
 {
     this.sidelong=sidelong;
  return sidelong;
 }
 public int Getsidelong(int sidelong)
 {
 return sidelong;
 }
 public void Print()
 {
 Console.WriteLine ("当前正方形的边长是:{0}",sidelong);
 }
}
class Square_Test
{
 public static void Main()
 {
 Square s1=new Square ();
  s1.Setsidelong (4);
  s1.Print ();
  Square s2=new Square ();
 }
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
在c#中如何使用结构体Struct
C#属性方法 构造函数(不知道自己理解的对不对)
C#函数(构造函数)的重载
笔记:《JavaScript面向对象精要》
.net反射详解
数据结构C#语言版 第二章 C#单链表的实现
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服