Doubts about class member modifiers

Source: Internet
Author: User
Tags modifiers
Questions for class member modifiers
Class a{
private static $p 1;
public static $p 2;
}

As in the code above, the member variable is preceded by the private static modifier and only with the private difference where? Similarly, where is the difference between public static and public?

------Solution--------------------
Static keyword: Declaring a class member or method as static can be accessed directly without instantiating the class. Static members cannot be accessed through an object (except static methods)
------Solution--------------------
Private, accessible only in declared classes
Public in common, can be accessed by anyone (default)
Static, only static access to the Classname::identifiers
------Solution--------------------
A static method or property that can be called externally,
Private definition, which can only be called inside a class
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.