Inheritance :
inheritance is a sharing of behaviour between two classes.
It allows you to define a class that extends the functionality of another class.
The extend keyword is used for inheriting from parent class.
Dart supports single inheritance, which means that a class can only inherit from
a single class.
Dart does not support multiple inheritance which means that a class cannot
inherit from multiple classes.
Syntax :
class ParentClass { // Parent class code } class ChildClass extends ParentClass { // Child class code }
Example :
class One { void jeet() { print('hiii how are you!'); } } class Two extends One {} void main() { var obj = One(); obj.jeet(); }
hii how are You!. Exited.