What Is OOP (Object Oriented Programming)
What Is OOP (Object Oriented Programming)
For example, all functionalities of a phone encapsulated in a software i.e. Android or iOS etc.
In the Dart Programming Language, both Class 2 and Class 1 above cannot be linked, as in Derived
class 3, as shown in C ++. Only one class can be linked. In Dart, the parent class can be called back
with the super keyword, and the child or current class can be used with this.
polymorphism refers to a programming language's ability to process objects differently
depending on their data type or class. More specifically, it is the ability to redefine
methods for derived classes.
Compile time polymorphism: It is also known as static polymorphism. This type of polymorphism is
achieved by function overloading or operator overloading.
Method Overloading: When there are multiple functions with same name but different parameters then these
functions are said to be overloaded. Functions can be overloaded by change in number of
arguments or/and change in type of arguments.
Operator Overloading: Java also provide option to overload operators. For example, we can make the
operator (‘+’) for string class to concatenate two strings. We know that this is the addition operator whose task
is to add two operands. So a single operator ‘+’ when placed between integer operands, adds them and when
placed between string operands, concatenates them.In java, Only “+” operator can be overloaded:
To add integers
To concatenate strings
Runtime polymorphism: It is also known as Dynamic Method Dispatch. It is a process in which a function
call to the overridden method is resolved at Runtime. This type of polymorphism is achieved by Method
Overriding. Method overriding, on the other hand, occurs when a derived class has a definition for one of the
member functions of the base class. That base function is said to be overridden.
Why do we study OOP? Because it is the most widely used programming paradigm
throughout the IT industry, and it has been for the past three decades. And it is the only practical
way to manage the complexity of large applications and systems. The procedural paradigm collapses
under the weight of extreme code size. The functional paradigm has not yet been proven for
handling large-scale software.
Because nearly all of the major programming languages we use today are OOP-based:
Java
Python
C#
C++
PHP
Ruby
Perl
Objective-C
Swift
Scala – multi-paradigm
Groovy
Delphi
The advantages of OOP(Benefits of OOP)
-OOP provides a clear modular structure for programs.
-It is good for defining abstract data types.
-Implementation details are hidden from other modules and other modules has a clearly defined
interface.
-It is easy to maintain and modify existing code as new objects can be created with small differences
to existing ones.
-objects, methods, instance, message passing, inheritance are some important properties provided
by these particular languages
-encapsulation, polymorphism, abstraction are also counts in these fundamentals of programming
language.
-It aims to implement real life scenario.
-In OOP, programmer not only defines data types but also deals with operations applied for data
structures.