using System;
namespace PropertyTest
{
class Student
{
int myID;
string myName;
int myAge;
public Student()
{
myID = myAge = 0;
myName = "";
}
public int ID
{
get { return(myID); }
set { myID = (value<0||value>100)?0:value; }
}
public string name
{
get { return((myName == "")?"NONAME":myName); }
set { myName = value; }
}
public int age
{
get { return(myAge); }
set { myAge = (value<0)?0:value; }
}
}
class Test
{
static void Main()
{
Student p = new Student();
p.ID = 200;
p.age = 15;
p.name = "CPE";
Console.WriteLine(p.ID);
Console.WriteLine(p.name);
Console.WriteLine(p.age);
Console.ReadLine();
}
}
}