Introduction to Object Oriented Programmming in Dart

Object-oriented programming (OOP) is a method of structuring a program by bundling related properties and behaviors into individual objects.
Dart is an object-oriented programming language, and it supports all the concepts of object-oriented programming.

Dart Object-Oriented Concepts:

- Class
- Object
- Inheritance
- Polymorphism
- Interfaces
- Abstract class

The above introductions give the basic idea of oops concepts. We will have a detailed discussion in upcoming tutorials.

  1. Class
  2. A user-defined prototype for an object that defines a set of attributes that characterize any object of the class.
    The attributes are data members (class variables and instance variables) and methods, accessed via dot notation.

  3. Object
  4. A unique instance of a data structure that's defined by its class.
    An object comprises both data members (class variables and instance variables) and methods.

  5. Inheritance
  6. The transfer of the characteristics of a class to other classes that are derived from it.
    The class that to be extended is called parent /superclass, and the newly created class is called child/subclass. Dart provides extends keyword to inherit the properties of parent class in child class.

  7. Polymorphism
  8. Polymorphism means "many forms", and it occurs when we have many classes that are related to each other by inheritance.

  9. Interfaces
  10. We can declare methods and variables inside the interface just like the class but in interface only abstract declaration of methods is provided. We can only define the function signature but not its body. Another class can implement the interface. It is basically used for data-hiding.

  11. Abstract Class
  12. An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.