asp.net代码练习 work088
animal.csusing 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
}
}
}
https://blog.51cto.com/u_15356972/3775755
页:
[1]