What is an abstract method?

In object -oriented programming, subroutities are called "methods" to perform functions in the program. These methods consist of programming orders that perform the action, set input parameters to customize actions, and can return or give up the value of some kind of object or class. Methods are actions performed in a program from a particular class or within an object and are used to access and handle data stored in the object. There are many different methods and each has special use. A specific type that is made of an abstract super class and inherited subclass is called an abstract method.

In general, an abstract method performs small or no implementation in its abstract super class. The codes contained in this method are considered dummies and are not implemented by themselves. This does not mean that a specific abstract method is not used in a particular abstract class. The abstract method rather works as a model or governor for subclass to complete the implementationmethods.

Super classes can contain more subclass and all subclass of super class have certain similar states and behavior. Abstract classes are therefore a type of virtual class that shows virtual inheritance. This means that any subclass derived from a super class inherits the limitation of the super class from which it is derived. Therefore, the methods in the subclass are derived from the abstract methods of super class. When programming and using abstract methods, the programmer must declare an abstract class rather than virtual.

For example, the super class "graphic objects" contains subclass "circle", "square", etc. As such, all circles and squares have the same states - orientation, position, color of filling, color - and behavior - movies, change, rotation, rotation, draw - like "graphic obstects."

Using abstract mEtody allows generalization at the highest level or super class and specification at lower levels or subclass. This hierarchy minimizes the amount of programming methods for each particular subclass. The use of these methods also allows the IDEEMPOTOTE OF SUPPLY, which means that if the method is implemented again and again, the result is always the same.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?