Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Concrete method in abstract class

I understand an abstract class may contain abstract and concrete methods (i.e with body implementation). My question are: can subclasses inherit/override concrete methods from an abstract superclass. And secondly do they have to implement concrete methods the same way they implement abstract methods?

like image 232
user2240664 Avatar asked May 21 '13 17:05

user2240664


1 Answers

A concrete method means, the method has complete definition but it can be overridden in the inherited class. If we make this method "final" then it can not be overriden. Declaring a method or class "final" means its implementation is complete. It is compulsory to override the abstract methods in the subclass otherwise the subclass would also be an abstract class and has to be declared abstract.

like image 175
Vishal Mopari Avatar answered Nov 07 '22 05:11

Vishal Mopari