I am using a component suite which has many abstract classes. Now I want to apply polymorphism but I am getting Error Abstract Class when I create my object.
Should I override all methods which are virtual even if I don’t need it? Are there any workaround or solution?
In order to make an instance of a class, you need to override all methods that are declared as virtual abstract. Even if you don’t use them.
If you really want a work around, you can use empty methods. But I won’t recommend that.
And to add some more information on the subject:
A method is abstract if it is declared with virtual abstract:
Trivia: You can even override a method as abstract:
You need to override these methods in order to instantiate from that class.
And you can declare an entire class as abstract:
You get a warning if you try to instantiate that class.
The counterpart is a sealed class:
You get a warning if you try to inherit from that class.
You can also seal methods, but you need the keyword final for that.