What are abstract classes and methods | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What are abstract classes and methods

23rd Oct 2017, 9:15 AM
Sai Kumar Reddy
Sai Kumar Reddy - avatar
3 Answers
+ 27
Your question isn't enough clear.
23rd Oct 2017, 9:57 AM
Chinthana Kavinda
Chinthana Kavinda - avatar
+ 1
Abstract classes and methods are designed to be inherited. You don't actually make objects using an abstract class; think of an abstract class as a kind of interface, of which any and all subclasses have the same variables / methods. For example, you don't make objects of "Food" (abstract class), but you make objects of "Apple" and "Orange" (actual class), of which extend the "Food" class. Similarly, abstract methods are supposed to be inherited; it just denotes that any class that has inherited the abstract method has a method with a given name, return, and parameters, that is the abstract method. How they implement the method can vary, which is why there is no body to an abstract method. It is just meant to denote that the class has a method with a specific name, return, and parameters.
23rd Oct 2017, 12:34 PM
Quantallax