Why is an abstract class implementing a function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why is an abstract class implementing a function

From what I have learnt abstract classes only declare a class without implementing them. But the abstract class is implementing the function. https://code.sololearn.com/cCPyZpwkWBM2/?ref=app https://code.sololearn.com/cCPyZpwkWBM2/?ref=app

5th May 2017, 10:02 PM
tylerasa
tylerasa - avatar
2 Answers
+ 5
it has functions because all the subclasses inherit them, but it is abstract so you only use the methods with the subclasses
5th May 2017, 10:14 PM
‎ɐısıօլɐ
‎ɐısıօլɐ - avatar
0
This seems to be common misconception. Classes with abstract methods must be abstract. But you can declare a class abstract, even if it does not include abstract methods. I have no idea, why do many people get that wrong. Just look at class Math.
6th May 2017, 12:22 AM
1of3
1of3 - avatar