+ 1
What are abstract classes and methods
3 Antworten
+ 27
Your question isn't enough clear.
+ 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.