Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the main advantage of making a class abstract

Why do we declare a class as abstract? I know it cannot be instantiated, but why give a special keyword for it. Even a 'normal' class will work just as well and can be easily subclassed. so what is the main advantage of making a class abstract?

like image 756
TimeToCodeTheRoad Avatar asked Dec 06 '22 00:12

TimeToCodeTheRoad


1 Answers

In abstract class you can implement some method and can make some abstract all your client will have to implement it also. you can provide some common functionality , also you can have some inherited fields and some of the skeleton method here

like image 96
jmj Avatar answered Dec 07 '22 22:12

jmj