Note:Unlike other object-oriented programming languages, in PHP, a class cannot use the final modifier for an attribute variable.
If you want to declare a property to be a constant, you can use the Const keyword, and you do not need to use the
PHP constants: Difference between define and const
A constant is the identifier (name) of a simple value ). As its name implies, this value cannot be changed during script execution (except for so-called magic constants, they are actually not
Basics of variables and constant variables
Variables in PHP are represented by a dollar sign followed by the variable name. Variable names are case sensitive and Chinese characters may also be valid.
By default, values are always assigned. PHP also
PHP Object-oriented-class constants
PHP Object-oriented-class constants
Class constants: A class that holds unchanged data for the duration of a run.
Defined:
const keyword
const constant NAME = constant value
Example:
Class Student
{
Public
Document directory
1. Use the preprocessing command # define to declare a constant to indicate the number of seconds in a year (ignore the leap year problem)
2. Write a "standard" macro MIN, which inputs two parameters and returns a smaller one.
1. static keywordsTo have a deep understanding of the static keyword, you must first master the composition of the Standard C program.Standard C Programs are always composed of the following parts:1) body segment-The machine instruction part
An address also occupies memory, but it does not need to be copied once.
From: http://blog.chinaunix.net/space.php? Uid = 589727 & do = blog & id = 2732640
Declaration of reference: Basic Format: Reference Type & reference name = referenced object
The static keyword has at least N functions:(1) The static variable in the function body applies to this function body. Unlike the auto variable, the memory of this variable is allocated only once, therefore, the value remains the value of the
1. Collection class Object ProblemsNote: in IE, you can use () or [] to obtain collection class objects;In Firefox, you can only use [] to obtain collection class objects.Solution: use [] to retrieve collection class objects.
However,
Analysis of C ++/C complex statements
Posted Wednesday, 2009/09/09-09:57 by easyeagel
Summary: This is an article by the translator on codeproject.ArticleThe author gives a more appropriate and detailed description of the process of
I. Regular data members
A data member that uses the const keyword for description. Its functions and usage are similar to common variables (const variables), but the values of common data members cannot be changed.
Note: You can only initialize
Chapter 2 other programming experience
11.1 use const to improve the robustness of functionsWhen you see the const keyword, C ++ programmers may first think of const constants. This is not a good conditioned reflection. If you only know that the
1. General Constants
Int const x = 2; or const int x = 2;
Of course, X is also an array, such as X [5]; int can be replaced with the class name, and X is the object name, which is usually an object at this time.
If int is replaced with char *, It is
Lecture 9: protection of shared data and dynamic processing of Objects
Basic Requirements
* Grasp: definitions of common objects, methods for introducing data members of common objects, and common references of objects.* Understanding:
I. Use of const in C
From:Http://blog.chinaunix.net/u/26828/showart_667881.html
Const is a key word in C language. It specifies that a variable cannot be changed. Using const can improve the robustness of the program to a certain extent. In addition,
1.doc ument. formname. Item ("itemname ")
Description: You can use document. formname. item ("itemname") or document. formname. elements ["elementname"]; In Firefox, only document. formname. elements ["elementname"].Solution: Use document. formname.
The static keyword has at least N functions:(1) The static variable in the function body applies to this function body. Unlike the auto variable, the memory of this variable is allocated only once, therefore, the value remains the value of the
I. Possible combinations:
(1) const char * P
(2) Char const * P
(3) char * const P(4) const char ** P
(5) Char const ** P
(6) char * const * P
(7) Char ** const P
Of course, there are several cases of inserting a const in (5), (6), and
Generally, the const keyword is used to define a constant field. In a sense, the readonly field also belongs to a constant field, but its requirements are "loose" than the const field.
The constant fields defined by these two keywords are described
Three main features of an object
Object behavior: You can perform operations on the object. If you turn on the light, turning off the light is behavior.
Object form: How the object responds, colors, dimensions, and shapes are applied.
Object
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.