我試圖用這個如何在C#中重載方法?
Date DOB
getAge()
getAge(Date DOB)
放我不知道如何重載這個方法誰能幫助我,請超載年齡?
public class Customer
{
private string CustomerID;
private string FirstName;
private string LastName;
private int Age;
private string Address;
private double phoneNumber;
public Customer(string CustomerID, string FirstName, string LastName, int Age, string Address, double phoneNumber)
{
this.CustomerID = CustomerID;
this.FirstName = FirstName;
this.LastName = LastName;
this.Age = Age;
this.Address = Address;
this.phoneNumber = phoneNumber;
}
public int age {get ; set; }
}
}
'age'不是這裏的一種方法;它的一個屬性 –
你試圖超載的方法是什麼?你的問題措辭的方式令人困惑。 – RScottCarson
我想超載Age,但我不知道如何使用超載方法 – user5520587