Dart教程
-
Dart编程实例-Object-Dart实例教程|
Dart编程实例 - Object class Student { void test_method () { print ( This is a test method ); } void test_method1 () { print ( This is a test method1 ); } } void main () { Studen...
-
Dart编程实例-Super关键字-Dart实例教程|
Dart编程实例 - Super 关键字 void main () { Child c = new Child (); c . m1 ( 12 ); } class Parent { String msg = message variable from the parent class ; void m1 ( int a ){ pr...
-
Dart编程实例-Static关键字-Dart实例教程|
Dart编程实例 - Static 关键字 class StaticMem { static int num ; static disp () { print ( The value of num is ${ StaticMem . num } ) ; } } void main () { StaticMem . num = 12 ...
-
Dart编程实例-方法覆盖-Dart实例教程|
Dart编程实例 - 方法覆盖 import dart:io ; void main () { Child c = new Child (); c . m1 ( 12 ); } class Parent { void m1 ( int a ){ print ( value of a ${ a } );} } class Chil...
-
Dart编程实例-类继承-Dart实例教程|
Dart编程实例 - 类继承 void main () { Child c = new Child (); c . m1 ( 12 ); } class Parent { void m1 ( int a ){ print ( value of a ${ a } );} } class Child extends Parent { @...
-
Dart编程实例-继承的类型-Dart实例教程|
Dart编程实例 - 继承的类型 void main () { var obj = new Leaf (); obj . str = hello ; print ( obj . str ); } class Root { String str ; } class Child extends Root {} class Lea...
-
Dart编程实例-dartgetters和setters-Dart实例教程|
Dart编程实例 - dart getters 和 setters class Student { String name ; int age ; String get stud_name { return name ; } void set stud_name ( String name ) { this . name = name ; ...
-
Dart编程实例-This关键字-Dart实例教程|
Dart编程实例 - This 关键字 void main () { Car c1 = new Car ( E1001 ); } class Car { String engine ; Car ( String engine ) { this . engine = engine ; print ( The engine is : $...
-
Dart编程实例-命名构造函数-Dart实例教程|
Dart编程实例 - 命名构造函数 void main () { Car c1 = new Car . namedConst ( E1001 ); Car c2 = new Car (); } class Car { Car () { print ( Non-parameterized constructor invok...
-
Dart编程实例-构造函数-Dart实例教程|
Dart编程实例 - 构造函数 void main () { Car c = new Car ( E1001 ); } class Car { Car ( String engine ) { print ( engine ); } }...
-
Dart编程实例-访问属性和函数-Dart实例教程|
Dart编程实例 - 访问属性和函数 void main () { Car c = new Car (); c . disp (); } class Car { // field String engine = E1001 ; // function void disp () { print ( engine ); ...
-
Dart编程实例-实现多个接口-Dart实例教程|
Dart编程实例 - 实现多个接口 void main () { Calculator c = new Calculator (); print ( The gross total : ${ c . ret_tot () } ); print ( Discount : ${ c . ret_dis () } ); } c...
-
Dart编程实例-实现一个接口-Dart实例教程|
Dart编程实例 - 实现一个接口 void main () { ConsolePrinter cp = new ConsolePrinter (); cp . print_data (); } class Printer { void print_data () { print ( __________Printing...
-
Dart编程实例-Lambda表达式-Dart实例教程|
Dart编程实例 - Lambda 表达式 void main () { printMsg (); print ( test ()); } printMsg () = print ( hello ); int test () = 123 ; // returning function...
-
Dart编程实例-递归函数-Dart实例教程|
Dart编程实例 -递归函数 void main () { print ( factorial ( 6 )); } factorial ( number ) { if ( number = 0 ) { // termination case return 1 ; } else { return ( number * factor...
-
Dart编程实例-可选参数和默认值-Dart实例教程|
Dart编程实例 - 可选参数和默认值 void main () { test_param ( 123 ); } void test_param ( n1 ,{ s1: 12 }) { print ( n1 ); print ( s1 ); }...
-
Dart编程实例-可选命名参数-Dart实例教程|
Dart编程实例 - 可选命名参数 void main () { test_param ( 123 ); test_param ( 123 , s1: hello ); test_param ( 123 , s2: hello , s1: world ); } test_param ( n1 ,{ s1 , s2 }) ...
-
Dart编程实例-可选位置参数-Dart实例教程|
Dart编程实例 - 可选位置参数 void main () { test_param ( 123 ); } test_param ( n1 ,[ s1 ]) { print ( n1 ); print ( s1 ); }...
-
Dart编程实例-函数参数-Dart实例教程|
Dart编程实例 - 函数参数 void main () { test_param ( 123 , this is a string ); } test_param ( int n1 , String s1 ) { print ( n1 ); print ( s1 ); }...
-
Dart编程实例-返回函数-Dart实例教程|
Dart编程实例 - 返回函数 void main () { print ( test ()); } String test () { // function definition return hello world ; }...