{
// methods
// properties
// indexers
// events
}
看看C# 几口的定义 比起java 的却是要麻烦些 不过概念还是一样的
C# 构造函数重载
public class WebSite
{
string siteName;
string url;
string description;
// Constructors
public WebSite()
: this(“No Site”, “no.url”, “No Description”) {}
public WebSite(string newSite)
: this(newSite, “no.url”, “No Description”) {}
public WebSite(string newSite, string newURL)
: this(newSite, newURL, “No Description”) {}
public WebSite(string newSite,
string newURL,
string newDesc)
{
siteName = newSite;
url = newURL;
description = newDesc;
}
}
转载于:https://my.oschina.net/u/2296689/blog/545745