【发布时间】:2014-07-25 07:41:24
【问题描述】:
当我构建时,VS 显示错误。这是我的代码:
public Composite buildComposite(ComboBox subs, ComboBox bas)
{
int count = 0;
Composite a = new Composite();
if (subs.SelectedItem != null)
{
foreach (Substance d in listSubstance)
{
if (String.Compare(d.notation, subs.Text) == 0)
{
count++;
a.subs = new Substance(d);
break;
}
}
}
if (bas.SelectedItem != null)
{
foreach (Base g in listBase)
{
if (String.Compare(g.notation, bas.Text) == 0)
{
count++;
a.bas = new Base(g);
break;
}
}
}
if (count > 0)
{
a.equilibrium();
a.settypesubs(arrayDefinition);
return a;
}
else
return null;
}
这是我的错误:
错误 1 可访问性不一致:返回类型 'Project_HGHTM9.Composite' 比方法 'Project_HGHTM9.Form1.buildComposite(System.Windows.Forms.ComboBox, System.Windows.Forms.ComboBox)' c:\users\nguyen 更难访问\documents\visual studio 2013\Projects\Project_HGHTM9\Project_HGHTM9\Form1.cs 172 26 Project_HGHTM9
【问题讨论】:
-
您的
Composite课程应该是公开的。去改变它 -
错误信息很容易解释。你不明白怎么回事?
-
您不能从本身不是公共的公共方法返回类型。
标签: c# winforms access-modifiers