DartLang
🎯 Dart (DartLang) Introduction: Object-oriented Programming
Dart supports all the features for Object-oriented programing paradigm like Classes, Inheritance, Interfaces, Polymorphism, etc.
Dart supports all the features for Object-oriented programing paradigm like Classes, Inheritance, Interfaces, Polymorphism, etc. Inheritance in Dart might seem a little weird but apart from that, everything is all right.
A class without constructor
We use class
keyword to create a class in Dart. Static Variables which live on the class should be marked with static
keyword. Instance Variables and Instance Methods live on the object. this
keyword inside an instance method points to the object itself, hence we can access a property of the object.
We have used toString
method which overrides the same method defined in the Object
class. This method (as discussed before) is used to represent an object in String format for string interpolation.
💡 We can also have static methods which should be marked with
static
…