评论

收藏

[R语言] asp.net代码练习 work088

编程语言 编程语言 发布于:2021-12-27 14:00 | 阅读数:590 | 评论:0

animal.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace work088
{
  public class Animal
  {
    private int _age;
    //访问器
    public int Age
    {
      get 
      {
        return _age;
      }
      set
      {
        this._age = value;
      }
    }
  }
}
webform1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace work088
{
  public partial class WebForm1 : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      work088.Animal bird = new Animal();
      bird.Age = 10;
      //无报错,即为ok
    }
  }
}

关注下面的标签,发现更多相似文章