Page 17 - Dart Language
P. 17

class Person {
           String name;
           String gender;
           int age;

           Person(String name, String gender, int age) {
             this.name = name;
             this.gender = gender;
             this.age = age;
           }
         }


        Now you can create an instance of Person like this:


         var alice = new Person('Alice', 'female', 21);


        Read Classes online: https://riptutorial.com/dart/topic/1511/classes


































































        https://riptutorial.com/                                                                               12
   12   13   14   15   16   17   18   19   20   21   22