How to instantiate an Abstract class in C#?

Asked

Viewed 75 times

-3

I know the class abstract cannot be instantiated. But I need to call it in Windows Forms and I’m not getting it.

  • Before posting anything do the Tour https://answall.com/tour of the website to learn how to ask questions. When you have trouble with code, tell us what you have tried to do and what errors you are getting.

  • Edit the question and enter your code and/or what you have done so far.. Along with this, explain what you are trying to do (the whole problem).

  • Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote).

1 answer

2

It is not possible, the reason it is abstract is precisely not to allow it to be instantiated. This type of class exists to be inherited.

You can inherit it in a concrete class and instantiate this daughter class. It is likely that you need to implement some missing part.

Maybe it’s not the right thing to do. If you need an abstract class the way it was conceived it gets weird. The problem may be another.

  • So how would I do?

  • 3

    You read the answer?

  • Yes, I’m a beginner in C#.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.