This article mainly introduces the definition of static keywords in PHP, the late binding and the difference with the Self keyword, interested in the friend's reference, I hope to help you.
Overview
is learning design patterns, there is an article
The function is defined as a static function by adding the static keyword before the return type of the function. A static function differs from a normal function in that it can only be seen in the file that declares it and cannot be used by other
1. Constants: Also known as final variables, can only be assigned once in the entire programfinal int num = 1215;num = 1216; //error, can only be assigned once2. Class member variable: A variable that is not defined in a method is a member variable,
Original address: http://blog.csdn.net/keyeagle/article/details/6708077Google has nearly three pages of the C language of static content, found that the available information is very little, either long-winded or in the key point of a few words, for
The static keyword is a keyword that exists in both C and C ++. It mainly has three usage methods. The first two are only used in C, the third method is used in C ++. (The detailed operations in C and C ++ vary. This document uses C ++ as the
The methods and fields in sqlhelper will not be mentioned. Let's talk about the static keyword usage in it.
Static keywords use methods and fields in the class to directly access them using the class name. I think everyone knows this basic
Description: In Java we often use the static keyword, which is the equivalent of a global variable (a static variable or a class variable). (1) When you add static to a method or variable in a class, the method or variable is only ' A ', in the
Static keyword Knowledge point collationStatic Features:1,static is a modifier that is used to decorate a member.2,static decorated members are shared by all of the objects.3,static takes precedence over the existence of an object because static
Features of the Static keyword
Loaded with the load of the class;
Precedence over the existence of objects;
Be shared by all objects of the class;
Can be called by the class name;
Memory Diagram Construction code
Object Oriented (iii)
first, constructor (construction method) 1. Overview and roleConstructors are also called constructor methods, and when you construct an object of a class, the constructor runs to initialize the instance domain (member
Declaring a class member or method static, you can access it directly without instantiating the class. Static members (except static methods) cannot be accessed through an object.
For compatibility with PHP4, if "visibility" is not specified,
First, Final keywords1. What is the final keywordThe advent of inheritance increases the reusability of code and facilitates development. However, there are problems, some classes do not want to be inherited after the description, or some of the
Static keyword features:
Loads as the class loads.
Precedence over the existence of an object.
shared by all objects
Can be called directly by the class name.
Use Note:
Static methods can only access static members.
Http://www.jb51.net/article/31878.htm
Today, read Bowen, see the C + + static keyword Some summary, but also involved in some of the code storage location, in order to have time to see, or to take it to the excerpt down.There are two uses for the
1, local variables: Only local variables, such as in the function body, in the For loop, in the IF statement to declare the defined variables, if not a specific keyword, he is a local variable.
2. Global variables: Variables that act on the entire
In C language, you can use the static keyword in the global scope: variable or function modified by the static keyword, only in this ". c file "is visible, while in other ". file C is invisible. For example, if the static function func is defined in
UITableViewCell Why the Static keyword is added when reusing IDsTake a look at iOS for various variable scopes and life cycle related knowledge:1, the method of temporary variables stored in the stack, out of this method, the temporary variables
The last static keyword, self-think more detailed. Do not know can leave a message. The following goes on: static Final member variable: is a member variable of a class that is both final and static decorated. It is similar to a member variable that
This section describes how to use the static keyword to define static methods and attributes. Static variables can also be used to define static variables and post-static binding. If the declared class property or method is static, you can directly
constructor function:1. The function name is the same as the class name, no return value type is defined, no specific return value2. The function that is called when the object is created, the creation object must be initialized by the constructor
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.