Abstract Method | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Abstract Method

What is the point of an abstract method?

26th Oct 2016, 4:52 PM
Amir Hassan Asvadi
Amir Hassan Asvadi - avatar
2 Answers
+ 5
By defining an abstract method, you are forcing subclasses to implement the method. You can then use the method on an object of the class (and since the class is abstract, you know it is of a subclass), and it will call the method of the right subclass automatically. Polymorphism in action. http://www.sololearn.com/app/sololearn/playground/cVZHf80U321P/
26th Oct 2016, 5:53 PM
Zen
Zen - avatar
+ 2
Zen, you forgot to make that public and we can't view it :P
26th Oct 2016, 6:28 PM
Schindlabua
Schindlabua - avatar