Under what circumstances is the abstract class used?
I do not think you need to use an abstract class.
interface is more useful than abstract class
but Why use the abstract class even though the interface is more convenient
Under what circumstances is the abstract class used?
I do not think you need to use an abstract class.
interface is more useful than abstract class
but Why use the abstract class even though the interface is more convenient
Well, they are two separate ideas that could be implemented for the same effect.
Interfaces are contracts, they don't have any behavior defined inside of them, they only provide the method signature, which have to defined elsewhere in the program. You can inherit them and then add your implementation of the methods provided.
Abstract classes, however, are actual classes, with written methods in it. When you inherit them, you already have some sort of behavior defined in the functions.
That's the tl;dr of abstract classes vs interfaces