//一个小Demo找女朋友
class MainClass
{
//类:不同的类具备的方法和属性
public static void Main (string[] args)
{
//创建对象
Man nan = new Man ();
//起的别名是什么在下方赋值的时候只能用当前别名
Girl n = new Girl ();
//给对象赋值
n.shengao = 170;
n.tizhong = 60;
n.qian = 100000;
n.faxing = "马尾";
//把属性赋给nan
nan.nv(n);
}
}
//定义一个男生
class Man{
public void nv(Girl sheng){
//获取传递对象的属性值
int h = sheng.shengao;
int w = sheng.tizhong;
int m = sheng.qian;
string fx = sheng.faxing;
//判断
if(h == 170 && w == 60 && m > 100 && fx == "马尾"){
//打印输出
Console.WriteLine ("跟我走吧");
//如果条件不满足就输出
}else{
//打印
Console.WriteLine ("走吧");
}
}
}
//定义一个女生
class Girl{
//定义女生的属性 身高 体重 钱 发型
public int shengao;
public int tizhong;
public int qian;
public string faxing;
}
}
//一个小Demo找女朋友 class MainClass { //类:不同的类具备的方法和属性 public static void Main (string[] args) { //创建对象 Man nan = new Man (); //起的别名是什么在下方赋值的时候只能用当前别名 Girl n = new G...