I can declare private static member variables in a class, but what does it mean?
What is the difference private static and public static member variables?
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.
It means these variables cannot be accessed anywhere except within the class itself.
publicmembers can be accessed from outside the class.protectedmembers can be accessed in the class and its derived classes &privatemembers can be only accessed within the class.Note that the member being
staticor not the same Access Specification rules apply to it.staticimplies the storage specification and that the some member will be shared across all the instances of the class it does not change where the member can be accessed.Good Read:
What are access specifiers? Should I inherit with private, protected or public?