第四章 上機1
阿新 • • 發佈:2019-02-18
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 深入.NET平臺_第四章
{
public enum Gender
{
男,女
}
}
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 深入.NET平臺_第四章 { class PM { public string ID; public string Name; public int Age; public Gender Gender; public int YearOfExpeerience; public PM(string id,string name,int age,Gender Gender,int yearOfExpeerience) { this.ID = id; this.Name = name; this.Age = age; this.Gender = Gender; this.YearOfExpeerience = yearOfExpeerience; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections; namespace 深入.NET平臺_第四章 { class Program { static void Main(string[] args) { SE se = new SE("1","蘇蘇",25,Gender.女,100); // Console.WriteLine(se); Console.WriteLine("大家好,我是"+se.Name+",我今年"+se.Age+"歲,性別:"+se.Gender+"工號是:"+se.ID+" 我的人氣是:"+se.Popularity); PM pm = new PM("520","琳琳",18,Gender.女,10000); Console.WriteLine("大家好,我是" + pm.Name + ",我今年" + pm.Age + "歲,性別:" + pm.Gender + "工號是:" + pm.ID + " 我的人氣是:" + pm.YearOfExpeerience); //Console.WriteLine(pm); Console.ReadLine(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections; namespace 深入.NET平臺_第四章 { public class SE { public string ID{ get; set; } public string Name{ get; set; } public int Age { get; set; } public Gender Gender { get; set; } public int Popularity { get; set; } public SE(string id,string name,int age,Gender Gender,int popularity) { this.ID = id; this.Name = name; this.Age = age; this.Gender = Gender; this.Popularity = popularity; } } }