You are on page 1of 1

What is object-oriented programming?

In object-oriented programming the programmers are able to create objects which contain data fields, methods as well as instructions as to how these data fields and methods should interact. This allows the object to function independently and depending on the function calling the object and the data presented to it, it can perform a pre-determined action. The beauty of this would be, the flexibility given to the programmers in calling such objects from anywhere in the programme and not having to type the same code repeatedly. What is a class? In order to understand the terms inheritance and polymorphism, first we needs to know what is meant by a class. In simple terms, a class can be described as a blue print for a factory, which allows it to produce certain items. Thus, a class will act as a blue print or more specifically as a template for the creation of objects. Therefore, a class needs to contain attributes, fields, properties as well as the behaviors such as methods, operations and features. What is inheritance? When a class is given the ability to use properties and methods of another generic class, it is said to inherit the functionality of the generic class. For example, one can define a class containing properties, methods and other functionality generic to all patients of a hospital known as patient class and several more classes containing details pertaining to specific disease conditions of each patient such as class pneumonia, diabetes and hypertension. The class patient in this instance will be known as the super class whereas the other classes which are more specific will be known as sub classes. In OOP, subclasses can make use of the generic properties and the methods of the super class, which is the concept described by the term inheritance. What is polymorphism?

You might also like