我有一个类613566757 / 4294967296 for outcomes 0,1,2,3
613566756 / 4294967296 for outcomes 4,5,6
,它应该使用EmployeeAccountPresenter
(继承自EmployeeAccountView
类)和Form
类的对象进行操作。
EmployeeBridge
namespace DBEmployee
{
class EmployeeAccountPresenter
{
public EmployeeAccountView form;
public EmployeeBridge bridge;
public EmployeeAccountPresenter(EmployeeAccountView _form, EmployeeBridge _bridge)
{
this.form = _form;
this.bridge = _bridge;
}
}
}
上课:
EmployeeAccountView
在我的Form1课程中,我做了:
namespace DBEmployee
{
class EmployeeAccountView : Form
{...
但我在这个'中得到了一个错误。参数:
无法转换为' DBEmployee.Form1'至 ' DBEmployee.EmployeeAccountView'
namespace DBEmployee
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
EmployeeBridge eb = new EmployeeBridge();
EmployeeAccountPresenter eap = new EmployeeAccountPresenter(this, eb);
}
}
}
类继承自EmployeeAccountView
类。为什么我不能转换?
答案 0 :(得分:3)
this
引用当前对象,类型为Form1
。 Form1
又是Form
的子类。
EmployeeAccountView
无处可去。
我怀疑你确实想要像这样定义你的表单:
public partial class Form1 : EmployeeAccountView
现在this
将是EmployeeAccountView
的子类型,可以作为参数传递给EmployeeAccountPresenter
。