Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 形式继承。无法转换类型_C#_Winforms_Inheritance - Fatal编程技术网

C# 形式继承。无法转换类型

C# 形式继承。无法转换类型,c#,winforms,inheritance,C#,Winforms,Inheritance,我有一个类EmployeeAccountPresenter,它应该与EmployeeAccountView(从表单继承而来)和EmployeeBridge类的对象一起操作 namespace DBEmployee { class EmployeeAccountPresenter { public EmployeeAccountView form; public EmployeeBridge bridge; public Emplo

我有一个类
EmployeeAccountPresenter
,它应该与
EmployeeAccountView
(从
表单继承而来)和
EmployeeBridge
类的对象一起操作

namespace DBEmployee
{
    class EmployeeAccountPresenter
    {
        public EmployeeAccountView form;
        public EmployeeBridge bridge;

        public EmployeeAccountPresenter(EmployeeAccountView _form, EmployeeBridge _bridge)
        {
            this.form = _form;
            this.bridge = _bridge;
        }
    }
}
EmployeeAccountView
class:

namespace DBEmployee
{
    class EmployeeAccountView : Form
    {...
在我的Form1课程中,我做:

namespace DBEmployee
{
    public partial class Form1 : Form
    {
        public Form1()
        {            
            InitializeComponent();
            EmployeeBridge eb = new EmployeeBridge();
            EmployeeAccountPresenter eap = new EmployeeAccountPresenter(this, eb);
        }

    }
}
但是我在'this'参数中得到一个错误:

无法从“DBEmployee.Form1”转换为 “DBEmployee.EmployeeAccountView”


EmployeeAccountView
类继承自
表单
类。为什么我不能皈依

引用当前对象,其类型为
Form1
Form1
又是
Form
的子类

EmployeeAccountView
没有任何地方发挥作用

我怀疑你真的想这样定义你的表单:

public partial class Form1 : EmployeeAccountView
现在,
将是
EmployeeAccountView
的一个子类型,可以作为参数传递给
EmployeeAccountPresenter