【发布时间】:2011-09-27 21:11:26
【问题描述】:
我需要从另一个构造函数的主体中调用一个构造函数。我该怎么做?
基本上
class foo {
public foo (int x, int y)
{
}
public foo (string s)
{
// ... do something
// Call another constructor
this (x, y); // Doesn't work
foo (x, y); // neither
}
}
【问题讨论】:
-
像 public foo (int x, int y , string s) 这样的构造函数怎么样
标签: c# constructor