Can you have an abstract method in a non abstract class?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
Works at the International Monetary Fund, Lives in Washington, D.C., USA.
Declaring a class abstract only means that you don't allow it to be instantiated on its own. Declaring a method abstract means that sub classes have to provide an implementation for that method. The two are separate concepts, but obviously you can't have an abstract method in a non-abstract class.
2023-06-17 06:42:37
评论(499)
Helpful(122)
Helpful
Helpful(2)

Zoe Clark
QuesHub.com delivers expert answers and knowledge to you.
Declaring a class abstract only means that you don't allow it to be instantiated on its own. Declaring a method abstract means that sub classes have to provide an implementation for that method. The two are separate concepts, but obviously you can't have an abstract method in a non-abstract class.