Classic example: the object-oriented graphic calculator is located in index. echo & nbsp; new & nbsp; Form (index. php); & nbsp; Form is a class with constructor. & Nbsp; echo & nbsp; new & nbsp; Result (); & nbsp classic example: object-oriented graphic calculator
In the index. php file
Echo new Form ("index. php"); // Form is a class with a constructor.
Echo new Result ();
What does this mean? isn't new an object created? In this way, the output object can also be used. What is the name of the created object?
Appendix:
The Form class is constructed as follows:
Function _ construct (){
$ This-> action = $ action;
$ This-> shape = isset ($ _ GET ["action"])? $ _ GET ["action"]: "rect ";
}
------ Solution --------------------
Echo new Form ("index. php"); returns the instantiated object of Form, which is an object. An error is reported when echo is output. print it using print_r.