Interface abstraction
abstract class Base{
func1();
func2();
}
Copy the code
Note: Abstract methods can be defined by omitting the function body, without adding keywords. An abstract class cannot instantiate an object, but it can be inherited, after which the subclasses must all implement the abstract methods.
Implicit interface
class People{
void greet(){
print("Hello");
}
}
class Student implements People{
@override
void greet(){
print("Hi,I'm Sean.");
}
}
greet(People){
p.great();
}
void main(){
greet(new Student());
}
Copy the code
The generic
void main(){ var names = new List<String>(); name.add('sean') var maps = new Map<int,String>(); maps[1]="value"; / / literal notation var infos = < String > [' Seth ', 'Kathy', 'layz]; var pages = <String,String>{ 'index.html':'Homepage', 'robots.txt':'Hints for web robots' }; }Copy the code