About Question enthuware.ocpjp.v8.2.1226 :
Posted: Wed Jun 22, 2016 8:18 am
Hi,
Why option 4 - You want to define common method signatures in the class but force subclasses to provide implementations for such methods. is valid here?
In question enthuware.ocpjp.v8.2.1229, description for option 1 is - This is a valid reason for declaring an interface but not an abstract class. Generally, the purpose of an interface is to identify and declare just the behavior. Actual implementation can come later. While abstract class is used when a common implementation is also identified. In that respect, an abstract class actually provides less abstraction than an interface.
From this explanation comes that if we have just signatures and no common implementation it is better to use interface and not an abstract class.
Maybe it should be - You want to define common method implementation in the class but force subclasses to provide specific implementations for such methods instead? Or a sort of this?
Why option 4 - You want to define common method signatures in the class but force subclasses to provide implementations for such methods. is valid here?
In question enthuware.ocpjp.v8.2.1229, description for option 1 is - This is a valid reason for declaring an interface but not an abstract class. Generally, the purpose of an interface is to identify and declare just the behavior. Actual implementation can come later. While abstract class is used when a common implementation is also identified. In that respect, an abstract class actually provides less abstraction than an interface.
From this explanation comes that if we have just signatures and no common implementation it is better to use interface and not an abstract class.
Maybe it should be - You want to define common method implementation in the class but force subclasses to provide specific implementations for such methods instead? Or a sort of this?