{
class Program
{
static void Main(string[] args)
{
ConNguoi cn1=new ConNguoi();
cn1.Nhap();
Console.WriteLine("Xuat ne");
cn1.Xuat();
cn1.KhaiThacCui();
Console.WriteLine("su dung phuong thuc moi");
Console.WriteLine("Tuoi la {0}",cn1.LayTuoi());
//minh hoa cach goi lam phuong thuc LayTuoi
Console.Write("Tuoi la {0}",cn1.LayTuoi());
Console.ReadLine();
}
}
public class ConNguoi
{
public string ten="";
public short tuoi=0;
public void Nhap()
{
Console.Write("Nhap vao ten:");
this.ten = Console.ReadLine();
Console.Write("Nhap vao tuoi:");
this.tuoi = short.Parse(Console.ReadLine());
}
public void Xuat()
{
Console.Write("Ten la:{0}",this.ten);
Console.Write("Tuoi la:{0}", this.tuoi);
}
public void KhaiThacCui()
{
////////////////
Console.WriteLine("Dang di khai thac cui");
}
public short LayTuoi()
{
return this.tuoi;
}
}
}
0 comments:
Post a Comment