Abstraction , Inheritance ,Encapsulation and Polymorphism
In this article i’ll try introduce you to a foundation of OOP in dart , i’m not Gonna write or talk some a very long sentence like other’s article and people. i’m just Gonna write a short sentence and try to mind it each pillar for 10 minutes and try to search refrences about it. that’s it ,and show the code to Get better understanding of the OOP in practical.
I’m here not to teach but to share what’s i’m learn.
First is Abstraction
Abstraction is simply making class. that do their own speciality task and use it in the main function.
Like in the above we use Human class on the main function and we can calls It’s abstraction we divide the task on making human object in Human Class
Second is Encapsulation
Encapsulation is simply making border of each class or data by set access modifiers like private to ensure other’s not bother anyone speciality task.
in the code just add this access modifiers “ _ ” on method or variable and it’s private
Third is Inheritance
Inheritance is making our class able to get some property or method from the other class that we extends .
Fourth is Polymorphism
Polymorphism is make our class able to customize the same property or Method from the parent that we extends by adding @override and if we use Super we get that method and able to add more thing we want to do and Receive different result
This post is made by purpose to sharing my knoweldge and looking for room Of improvement , ready and want to be criticized , if you have your own Thought don’t hesitate to share on the comment below!