Why is the default access modifier of getters and setters is public and not private?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
getandsetportions of a property are not defaulted to public, they are defaulted to whichever is the visibility of the property they belong to. The default visibility of the property iself is private, as for all other kinds of members.