class Visitor{ var _name; //private property set name(value) => _name = value; //setter for private property get name => _name; //getter for private property } void main() { var visitor = new Visitor(); visitor.name = "Erik"; print ("Hello, ${visitor.name}"); }
Setter and Getter for private property |
No comments:
Post a Comment