9. OOP in Dart

Understanding OOP in Dart

OOP in Dart stands for Object Oriented programming. It supports features of classes and objects just like other OOP languages.

OOP has several advantages over Procedural programming.

  • OOP is faster and esaier to execute
  • OOP provides a clear structure for the programs
  • OOP make use of code i.e. they are reusable

What are the main aspects of OOP?

Classes and Objects are the main two aspects of object-oriented programming. Objects are the primary source to implement in code. It binds othe the data and functions together so that on other can acess the data except the function.

What are the features of OOP?

The features of OOP are also its main pillars. They are discuss below:

Features Description
Abstraction Abstraction is the property that only displays the essential details to the user. Data Abstraction is the process of identifying only the required characteristics of an object, ignoring the irrelevant details.
Encapsulation Encapsulation is defined as the wrapping up of data under asingle unit. It is the mechanism that binds together the code and the data it manipulates. It is also called data-hiding because the data in a class is hidden from other classes. The way to acheive encapusulation is by making a private class with public methods.
Inheritance Inheritance is the property which allows to inherit the features and methods of another class. Inheritance is achieved bu using extend keyword.
Polymorphism Polymorphism refers to the ability to differentiate between entities with the same name efficiently. Polymorphism is achieved by two ways Overloading and Overriding.