// provide read and write access to an object’s properties
class Cat {
    String name;

    // getter
    String get catName {
        return name;
    }
    // setter
    void set catName(String name){
        this.name = name;
    }
}
Comments