Object-oriented examples
Understanding: Reducing the redefinition of variables such as variables before the Var $ idea more clearly
Class Yuan----do not add () to create class {var$banjing;//a member variable of a circle class this variable is preceded by the Var $ z variable when the object's //area, member method functionMianji () {return3.14*$ This->banjing*$ This-banjing; }} Thisrefers to an object (instance) that references this class $maxyuan=NewYuan (); $maxyuan->banjing = 10;//You don't need to add any symbolic symbols to the banjing before you can have a definition in a class.//build a small circle$minyuan =NewYuan (); $minyuan->banjing = 5; Echo $maxyuan->mianji ()-$minyuan->mianji ();Finding the area difference of two circles (object-oriented method)
Process-oriented is a process-oriented problem.
// find the area of the shadow between two circles /* $r 1 = ten; $r 2 = 5; $mj = 3.14* $r 1* $r 1-3.14* $r 2;echo $r; */
process-oriented area
The difference between a class and an object
Category 1: Abstract many objects of ambiguity
2. Object: an instance of an instance class
When using object-oriented, you must first initialize (instantiate)---> Tell the computer that it belongs to a certain class of
In the title: $maxyuan = new Yuan (); Separate a frame from the Circle class (instance independent individual (object)) Add content below (see above)
PHP Object-oriented explanation