相关疑难解决方法(0)

C#中抽象类的构造函数

为什么可以在C#中为抽象类编写构造函数?
据我所知,我们无法实例化一个抽象类..那么它的用途是什么?
你无法实例化这个类,对吧?

c# constructor abstract-class

193
推荐指数
6
解决办法
16万
查看次数

如何在WPF中创建Abstract Class of System控件的实例?

我在WPF中编写了这段代码:

   System.Windows.Controls.Panel Panel1 = null;
   Panel1 = new System.Windows.Controls.Panel();
Run Code Online (Sandbox Code Playgroud)

但是它说:

Error1 Cannot create an instance of the abstract class or interface 'System.Windows.Controls.Panel'
Run Code Online (Sandbox Code Playgroud)

怎么解决这个?任何人都可以回答我的问题

.net c# wpf

2
推荐指数
1
解决办法
787
查看次数

C# - 无法创建抽象类或接口的实例

Cannot create an instance of the abstract class or interface在C#教程中收到错误.

它在这条线上失败了: result = new Account(nameText, addressText, balance);

这是我的班级:

public abstract class Account : IAccount
{
    //---------------------------------------------------------------
    // Constructor
    //---------------------------------------------------------------
    public Account(string inName, string inAddress, decimal inBalance)
    {
        name = inName;
        address = inAddress;
        balance = inBalance;
    }
    public Account(string inName, string inAddress) :
        this(inName, inAddress, 0)      // 'this ties this alternate constructor back to the original constructor (directly above)
    {
    }
    public Account(string inName) :     // 'this ties …
Run Code Online (Sandbox Code Playgroud)

c# oop interface class

-9
推荐指数
1
解决办法
9161
查看次数

标签 统计

c# ×3

.net ×1

abstract-class ×1

class ×1

constructor ×1

interface ×1

oop ×1

wpf ×1