Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
hell169548yIts a class that cannot be instantiated (new className())
Its like an interface but you can have functional methods on an abstract class.
Non functional methods must have no body and the modifier "abstract" on the method declaration: public abstract double methodName();
Its a "contract" (as well as interfaces) to concrete (non-abstract) subclasses that assure they will implement the abstract methods but will also have the functionality of the concrete methods.
Hope it helps and if anything is wrong or missing, please correct me :) -
Yeah6916298y@azous in addition:
An abstract class can use its own abstract functions as if they are implemented, because all concrete classes deriving it have to override the abstract functions.
Usually abstract classes would use abstract functions for the template method pattern (Gang of Four). -
@azous assuming this is Java we can actually have working default methods in plain interfaces. Abstract classes, however, have the benefits of inheriting public and protected instance variables as well as having the behavior of an interface.
This book be like
Friend: Can you explain this?
I(clueless): Sure ...
undefined