What is Object Oriented Programming?
Object Oriented Programming (OOPs) is a kind of programming based on the methodology of objects rather than just functions and procedures. Individual objects are grouped into classes. OOPs implement real-world entities like inheritance, polymorphism, hiding, etc, into the world of programming. It integrates data and code together.
Why OOPs? OR Benefits of OOPs•
OOPs makes programming transparent and hence ease complexity in problems
• Code is reusable through inheritance and cuts down on reduplicating
• Data and code works togegher by encapsulation
• OOPs permits data hiding, hence private data is kept secret.
What are the fundamental features/pillars of OOPs?
• Inheritance
• Encapsulation
• Polymorphism
• Data Abstraction
What is a class?
Class is a prototype, which contains objects in various states and behaviors. Class contains number of methods which are common to the opbjects.
What is an object?
An object is a run time entity which represents the class.It is the basic unit of OOPs, for example, chair, cat, dog, etc. Multiple objects have different states or attributes and behaviors.
Note: Class is a concept and to map this concept in real life is an object.
What is inheritance?
Inheritance is the property of OOPs and is also a feature of OOPs with the help of classes, you can inherit common properties from other classes. It means for example if there is a class like ‘vehicle’, then other classes like ‘car’, ‘bike’, etc, can inherit common properties from the vehicle class. Redundancy is avoided by inheritance, thereby reducing the overall size of the code.
What is a superclass?
A superclass or base class is the class that serves as the parent to some other class or classes. In example, Vehicle is a superclass of class Car.
Find the meaning of polymorphism
In actual words, polymorphism is the behavior that exists in different forms. That is, giving multiple meanings of a single interface. For example, if you have a class named Vehicle then it can have a method named
Speed but cannot define it because different vehicle has different speeds. This method will be defined by subclasses, and different definitions will be made for different types of vehicle.
What is function/method overloading?
Method overloading is one of the features of OOPs, by means of which it is possible to give the same name to more than one method within a class if the arguments passed differ.
What is function/method overriding?
Method overriding is one of the features of OOPs. By this, the subclass or child class can override the methods that already exist in the parent class or the base class. In this case, the overridden method shares the same name with the same signature. It means that the parameter list as well as the return type is identical.
What is data abstraction?
Data Abstraction means showing the essential features of an object while hiding the non-essential details. In other words, it refers to representing just enough of the information in a model to do the required tasks. Data Abstraction is a very vital feature of OOPs, which projects the important information while hiding implementation details. For example, while you are riding a bicycle, you know that if you push up then the accelerator your speed will increase but you don’t know how it really happens. That’s data abstraction since the implementation detail is out of reach of a rider. There is encapsulation, where the data and the code that works on that are bound together in a single unit-for example, a class. Encapsulation also allows for data-hiding because the data specified in one class is hidden from other classes.
What is an abstract class?
An abstract class is a class that can be instantiated. They are almost declared but not defined. These methods need to be exclusively defined in the subclass if they are going to be used in some subclass.
Can you instantiate an abstract class?
No. The abstract class cannot be instantiated because an abstract class does not have an implementation completed. However, it is still possible to create an instance of the subclass that inherits the abstract class.
An interface?
This is an abstract concept of OOPs which you can declare methods without any definitions. Interfaces do not contain a blueprint like classes because they do not have detailed instructions or actions to be performed. The class implementing an interface defines the methods of the interface.
What are virtual functions?
Virtual functions are those functions which are declared in the parent class. They are overridden in the subclass and are used to achieve runtime polymorphism.
For more information & classes Call: 2048553004
Registration Link: Click Here!
Author: Jyotsna Binjwe
Software Development Trainer
IT Education Centre Placement & Training Institute
© Copyright 2024 | IT Education Centre.