+ 1

Can I define an abstract class without adding an abstract method?

A good example can be found in the decorator pattern, see here a WindowDecorator and CoffeeDecorator are abstract classes but neither includes an abstract method.

29th Aug 2017, 2:06 PM
Gausiya Momin
Gausiya Momin - avatar
1 Antwort
+ 7
Yes, you can. An abstract class can exist without abstract method, but an abstract method must be written within an abstract class.
29th Aug 2017, 2:15 PM
Shamima Yasmin
Shamima Yasmin - avatar