Overview of members in a class
Object-oriented programming is the need to do something through an "object" (to accomplish some sort of task);
and
Objects are always derived from classes;
So:
Object-oriented programming, everything begins with a defined class;
the members of the class are divided into 3 categories :
Property:
Method:
Constant:
form, roughly as follows:
class name {
constant definition 1;
constant Definition 2;
.......
attribute definition 1;
attribute definition 2;
........
method definition 1;
method definition 2;
.......
}
Description
Above, there is no order problem; In practice, the constants are put in front, then the attributes, then the methods;
In detail, it is also divided into:
Property:
Common Properties;// general properties, instance properties
static properties;
Method:
common method;// general method, instance method
static method;
Construction method;
Destruction method;
Constant:
class Constants
when a constant is defined in a class, the constant is called a "class constant"-essentially a constant;
definition form:
class name {
Const constant name = constant value;
You cannot use define () to define it!
}
form of Use:
The use of constants is through the class name and is used with the range resolver (::);
class Name:: Constant name ;
Example:
Members and constants in classes in PHP