Skip to main content

One doc tagged with "getters"

View all tags

Properties: Getters, Setters, and Deleters

We've seen how to use private attributes (name) and public methods (getname(), setname()) to enforce encapsulation. This pattern, common in languages like Java or C#, is often called the "getter/setter" pattern.