using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
/*School school1 = new School();
school1.schoolname = "河北软件职业技术学院";
school1.schooladdress = "保定市北市区职大路1号";
school1.schoolarea = 100;
school1.inschool = 10000;
School school2 = new School();
school1.schoolname = "清华大学";
school1.schooladdress = "北京市海淀区圆明园路";
school1.schoolarea = 1000;
school1.inschool = 20000;*/
School school3 = new School();
/*school3.SetSchoolArea(400);
school3.SchoolName = "河北大学1";
Console.WriteLine(school3.SchoolName);
school3.Yingjian = "不硬";
Console.WriteLine(school3.Yingjian);*/
school3.InSchool = 400;
Console.WriteLine(school3.InSchool);
//Console.WriteLine(school3.GetSchoolArea());
Console.ReadKey();
}
}
class School
{
private string schoolname;
public string SchoolName
{
set
{
if (value == "河北大学")
{
schoolname = value;
}
else
{
schoolname = "您选择的学校不存在";
}
}
get { return schoolname; }
}
private string schooladdress;
private double schoolarea;
private int inschool;//在校人数
public int InSchool
{
get { return InSchool; }
set { InSchool = value; }
}
private string _yingjian;
public string Yingjian { get { return _yingjian; } set { _yingjian = value; } }
public string Ruanjian { get; set; }//仅仅是为了开发者书写方便
/*public string schoolname;
public string schooladdress;
public double schoolarea;
public int inschool;//在校人数*/
//为字段赋值
public void SetSchoolArea(double area)
{
if (area > 10 && area < 1000)
{
schoolarea = area;
}
}
//取值
public double GetSchoolArea()
{
return schoolarea;
}
private void Kaixue()
{
}
private void Zhaosheng()
{ }
private void Shoufei()
{ }
}
}